import { EventTarget as fe, Assets as mt, Link as v, Node as w, EventBase as ve, RectPosition as b, EllipseNode as St, Cursor as S, AnchorProxy as Ct, AnchorUsageType as q, FunctionName as A, Point as Q, NDCAnchor as Se, NEHelper as R, NE as Ce, Rectangle as ye, Layer as wt, ResourceSystem as ae, StageMode as we, NodeHelper as Ie, Shape as ke, RegSystem as le } from "@jtopo/core";
import { PopupMenu as Te, InputTextfield as Le, Tooltip as Ee } from "@jtopo/extensions";
function kt() {
  const s = ["editor", "canvas", "block", "zIndex", "preventDefault", "div", "addEventListener", "366790DTcyyT", "dargItem", "3398238faWmfK", "top", "removeEventListener", "485547IGykwm", "black", "144LpwDnx", "left", "offsetTop", "5367760bbfqFl", "white", "shape", "style", "cloneNode", "jtopo_iconsPanel", "35284RbGpaJ", "1904329vebsgP", "touchend", "itemSize", "getShape", "12okxAyr", "none", "4286675hFWuiX", "removeChild", "panelDom", "26KvTFhm"];
  return (kt = function() {
    return s;
  })();
}
function F(s, t) {
  const e = kt();
  return (F = function(n, i) {
    return e[n -= 225];
  })(s, t);
}
(function() {
  const s = F, t = kt();
  for (; ; )
    try {
      if (parseInt(s(229)) / 1 * (parseInt(s(253)) / 2) + -parseInt(s(242)) / 3 * (-parseInt(s(258)) / 4) + -parseInt(s(226)) / 5 + parseInt(s(239)) / 6 + -parseInt(s(254)) / 7 + parseInt(s(247)) / 8 + parseInt(s(244)) / 9 * (-parseInt(s(237)) / 10) === 465336)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class tn extends fe {
  constructor(t, e) {
    const n = F;
    super(), this[n(256)] = 40, this.stage = t, this[n(230)] = e, this.panelDom;
    let i = document.createElement(n(235));
    return i.style.display = "none", i.classList.add(n(252)), this.stage.uiContainer.appendChild(i), this.panelDom = i, this;
  }
  setConfig(t) {
    let e = this, n = this.panelDom;
    return t.items.forEach(function(i) {
      const o = F;
      let r = document.createElement("div");
      if (r.classList.add("item"), r.setAttribute("draggable", !0), r.ondragstart = function(a) {
        e.dargItem = i;
      }, n.appendChild(r), i.shape != null) {
        let a = document.createElement(o(231));
        a.width = e.itemSize, a.height = e.itemSize;
        let l = mt[o(257)](i.shape);
        if (l == null)
          throw Error("shape not exist: " + i[o(249)]);
        mt.drawToCanvas(l, a, { size: 0.8 * e[o(256)], strokeStyle: o(243), fillStyle: o(248), padding: 2 }), r.appendChild(a);
      } else
        r.innerHTML = i.iconHtml;
      r.addEventListener("touchstart", function(a) {
        const l = o;
        a[l(234)](), e[l(238)] = i, e.touchStartHandle(r, a);
      });
    }), this;
  }
  touchStartHandle(t, e) {
    const n = F;
    let i = t[n(251)](!0);
    t.parentNode.appendChild(i);
    let o = e.touches[0], r = o.clientX, a = o.clientY;
    const l = t.offsetLeft, c = t[n(246)];
    i.style.position = "absolute", i[n(250)][n(233)] = "1000";
    const h = function(u) {
      const g = n;
      let m = u.touches[0], y = m.clientX - r, x = m.clientY - a;
      i.style[g(245)] = l + y + "px", i.style[g(240)] = c + x + "px";
    }, d = this, p = function(u) {
      const g = n;
      t[g(241)]("touchmove", h), t.removeEventListener(g(255), p), i.parentNode[g(227)](i), d.editor.mockDrop(u);
    };
    h(e), t[n(236)]("touchmove", h), t[n(236)]("touchend", p);
  }
  getDragItem() {
    return this.dargItem;
  }
  hide() {
    const t = F;
    return this[t(228)].style.display = t(225), this;
  }
  show() {
    const t = F;
    return this.panelDom.style.display = t(232), this;
  }
}
const T = $;
function $(s, t) {
  const e = Tt();
  return ($ = function(n, i) {
    return e[n -= 414];
  })(s, t);
}
function Tt() {
  const s = ["fontFamily", "节点属性", "__folders", "gui", "7,3", "20px", "textBaseline", "34px", "167290wIhiYu", "30px", "1776UobtUI", "fillStyle", "globalAlpha", "className", "name", "appendChild", "originPosition", "editor", "textAlign", "10283CJTrwX", "folders", "12px", "图层属性", "斜切X", "isNode", "42px", "normal", "butt", "10px", "getFolder", "填充颜色", "26px", "setValue", "middle", "basic", "type", "linkCtrlBox", "3090CNZYYg", "setCurrentObject", "property", "9RtavOJ", "46px", "display", "style", "domElement", "线条粗细", "right", "64AoEoZZ", "position", "onFinishChange", "912aAyuto", "6348xhPCYb", "fontWeight", "dat", "22px", "round", "showProperty", "66px", "258345MacJro", "target", "lineWidth", "3284664uKKeIA", "36px", "color", "连线属性", "10,1", "italic", "lineCap", "bold", "16px", "整体透明度", "101288XNgjoQ", "add", "onChange", "open", "52px", "addFolder", "__controllers", "8221424DKLOZG", "垂直对齐", "bold italic", "newFolder", "hide", "update", "top", "width", "keys"];
  return (Tt = function() {
    return s;
  })();
}
(function() {
  const s = $, t = Tt();
  for (; ; )
    try {
      if (-parseInt(s(483)) / 1 * (-parseInt(s(470)) / 2) + parseInt(s(494)) / 3 + -parseInt(s(480)) / 4 * (parseInt(s(491)) / 5) + -parseInt(s(484)) / 6 * (-parseInt(s(452)) / 7) + -parseInt(s(424)) / 8 + parseInt(s(473)) / 9 * (-parseInt(s(441)) / 10) + parseInt(s(417)) / 11 * (-parseInt(s(443)) / 12) === 824235)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class en {
  constructor(t, e) {
    const n = $;
    this.editor = t, this[n(486)] = e, this.gui = new e.GUI(), this.object, this[n(453)] = {};
  }
  [T(471)](t) {
    const e = T, n = this.editor, i = this[e(450)].stage;
    i.inputSystem[e(492)] = t, i.selectedGroup.removeAll()[e(418)](t), t instanceof v ? n[e(469)].attachTo(t) : t instanceof w && n.nodeResizeBox.attachTo(t), n.update(), this.showProperty(t);
  }
  [T(489)](t) {
    const e = T;
    if (t == null)
      return;
    this[e(467)] = { id: t.id || "", className: t[e(446)] || "", name: t.name || "", type: t.type || "", x: 1, y: 1, imageSrc: "", width: 1, height: 1, text: "", rotation: 0, scaleX: 1, scaleY: 1, skewX: 0, skewY: 0, originPosition: "center", draggable: t.draggable };
    const n = this.editor.stage.styleSystem.currentTheme.getStyle(t.className) || {};
    this.style = { lineDash: null, backgroundColor: n.backgroundColor || "", strokeStyle: n.strokeStyle || "black", fillStyle: n[e(444)] || "black", color: n[e(496)] || "black", borderWidth: n.borderWidth || 0, fontSize: n.fontSize || 12, fontFamily: n.fontFamily || "楷体", lineWidth: n.lineWidth || 0, lineCap: e(460), globalAlpha: 1, fontWeight: n.fontWeight || "normal", textPosition: n.textPosition || "cb", textBaseline: n[e(439)] || "top", textAlign: n[e(451)] || "center" };
    const i = this.basic, o = this[e(476)];
    Object[e(432)](i).forEach(function(a) {
      if (t[a] != null) {
        let l = t[a];
        i[a] = l;
      }
    });
    let r = t.getComputedStyle();
    Object.keys(o).forEach(function(a) {
      let l = r[a];
      r[a] != null && (o[a] = l);
    }), this.object == null && (this.object = t, this.init()), this.object = t, this.setFolderValues(i, o), t[e(457)] && this.getFolder("节点属性") != null ? (this.getFolder(e(434)).show(), this.getFolder("连线属性").hide(), this.getFolder("图层属性")[e(428)]()) : this[e(462)]("连线属性") != null ? (this.getFolder("连线属性").show(), this.getFolder("节点属性").hide(), this.getFolder(e(455))[e(428)]()) : this[e(462)]("图层属性") != null && (this[e(462)]("图层属性").show(), this[e(462)](e(434))[e(428)](), this.getFolder(e(497)).hide());
  }
  newFolder(t) {
    const e = T, n = this[e(436)][e(422)](t);
    return this.folders[t] = n, n;
  }
  getFolder(t) {
    return this.folders[t];
  }
  getCtrollerValue(t, e) {
    return this.getCtroller(t, e).getValue();
  }
  getCtroller(t, e) {
    const n = T;
    return this.getFolder(t)[n(423)].find((i) => i.property == e);
  }
  setFolderValues(t, e) {
    const n = T;
    Object.keys(this.gui[n(435)]).forEach((i) => {
      this.gui.__folders[i].__controllers.forEach(function(o) {
        const r = $;
        let a = o[r(472)];
        t[a] != null ? o[r(465)](t[a]) : e[a] != null && o.setValue(e[a]);
      });
    });
  }
  init() {
    const t = T, e = this, n = this.editor, i = n.stage, o = this.basic, r = this.style;
    let a = { 实线: "", "虚线1,1": "1,1", "虚线2,2": "2,2", "虚线3,3": "3,3", "虚线7,3": t(437), "虚线3,7": "3,7", "虚线10,1": t(498), "虚线1,10": "1,10" }, l = { "10px": t(461), "12px": t(454), "14px": "14px", "16px": t(415), "18px": "18px", "20px": t(438), "22px": t(487), "24px": "24px", "26px": t(464), "28px": "28px", "30px": t(442), "32px": "32px", "34px": t(440), "36px": t(495), "38px": "38px", "40px": "40px", "42px": t(458), "44px": "44px", "46px": t(474), "48px": "48px", "50px": "50px", "52px": t(421), "54px": "54px", "56px": "56px", "58px": "58px", "60px": "60px", "62px": "62px", "64px": "64px", "66px": t(490), "68px": "68px" }, c = { 正常: t(459), 粗体: t(414), 斜体: t(499), 加粗斜体: t(426) }, h = { 默认: t(460), 圆形: t(488), 矩形: "square" }, d = { 上: t(430), 中: t(466), 下: "bottom" };
    function p() {
      const M = t;
      let W = this.property, B = this.getValue();
      e.object[W] = B === "" ? null : B, n[M(429)]();
    }
    function u() {
      const M = t;
      let W = this.property, B = this.getValue(), at = e.object;
      W == "lineDash" && typeof B == "string" && (B = B.split(",")), at.setStyle(W, B === "" ? null : B), n[M(429)]();
    }
    const g = this[t(427)]("基础属性");
    g.add(o, "id")[t(482)](p).name("id"), g.add(o, t(446))[t(482)](p).name("className"), g.add(o, "name").onFinishChange(p).name("name"), g.add(o, "type")[t(482)](p).name(t(468)), g.open();
    const m = this.newFolder("图层属性");
    m[t(418)](r, "backgroundColor").onChange(u).name("背景颜色"), m.open();
    const y = this.newFolder("节点属性");
    y[t(418)](o, "text")[t(482)](p)[t(447)]("文字"), y[t(418)](o, "x")[t(482)](p), y.add(o, "y").onFinishChange(p), y.add(o, t(431), 1)[t(419)](p).name("宽度"), y.add(o, "height", 1).onChange(p).name("高度"), y.add(o, "scaleX", -3, 3, 0.1).onChange(p)[t(447)]("缩放X"), y.add(o, "scaleY", -3, 3, 0.1).onChange(p)[t(447)]("缩放Y"), y.add(o, "skewX", -1, 1, 0.1)[t(419)](p).name(t(456)), y.add(o, "skewY", -1, 1, 0.1)[t(419)](p).name("斜切Y"), y.add(r, t(493), 0, 10).onChange(u).name("线条粗细"), y.add(r, "lineDash", a).onChange(u).name("虚实"), y.add(r, "borderWidth", 0, 10).onChange(u)[t(447)]("边框粗细"), y[t(418)](r, "fillStyle").onFinishChange(u).name(t(463)), y.add(r, "strokeStyle")[t(482)](u).name("线条颜色"), y[t(418)](o, "imageSrc")[t(482)](p).name("图片路径"), y.add(r, t(445), 0, 1, 0.1).onChange(u).name(t(416)), y[t(418)](o, t(449), { 中心: "center", 左上: "lt", 上中: "ct", 右上: "rt", 左下: "lb", 下中: "cb", 右下: "rb" }).onFinishChange(p).name("原点位置"), y.add(o, "draggable", !0).onChange(p).name("是否可拖拽"), y.open();
    const x = this.newFolder(t(497));
    x.add(o, "text").onFinishChange(p).name("文字"), x.add(r, "lineWidth", 0, 100)[t(419)](u).name(t(478)), x.add(r, "strokeStyle").onFinishChange(u).name("线条颜色"), x.add(r, "lineDash", a).onChange(u)[t(447)]("虚实"), x.add(r, t(500), h)[t(419)](u).name("末端样式"), x.add(r, "globalAlpha", 0, 1, 0.1).onChange(u)[t(447)]("整体透明度"), x.open();
    const C = this.newFolder("文本");
    C.add(r, t(433), ["sans-serif", "Arial", "宋体", "隶书", "楷体"]).onChange(u).name("字体名称"), C.add(r, "fontSize", l)[t(419)](u).name("大小"), C[t(418)](r, t(485), c)[t(419)](u)[t(447)]("粗细"), C.add(r, "textPosition", { 中心: "center", 左上: "lt", 上中: "ct", 右上: "rt", 左下: "lb", 下中: "cb", 右下: "rb" })[t(419)](u)[t(447)]("位置"), C.add(r, "textAlign", { 左: "left", 中: "center", 右: "right" })[t(419)](u)[t(447)]("水平对齐"), C.add(r, "textBaseline", d)[t(419)](u).name(t(425)), C.add(r, "color").onChange(u).name("颜色"), C[t(420)]();
    let D = this.gui.domElement;
    D.remove(), i.uiContainer[t(448)](D), D.style[t(481)] = "absolute", D.style[t(479)] = "-15px", D[t(476)].top = "0px", D[t(476)].zIndex = 1e3;
  }
  [T(420)]() {
    const t = T;
    this[t(436)][t(420)]();
  }
  close() {
    this.gui.close();
  }
  hide() {
    const t = T;
    this[t(436)][t(477)].style[t(475)] = "none";
  }
  show() {
    const t = T;
    this.gui.domElement.style[t(475)] = "block";
  }
}
const ce = Lt;
function Lt(s, t) {
  const e = Et();
  return (Lt = function(n, i) {
    return e[n -= 393];
  })(s, t);
}
function Et() {
  const s = ["46260HchKho", "925239sseVib", "131DyIuzp", "4400pAMBGJ", "1243808pObLuG", "6NFhUkk", "rgba(0,255,255,0.9)", "7556568HspUgm", "142045OYxNMN", "2844417zoeyKj", "6580llKSuo", "rgba(0, 255,255, 0.9)"];
  return (Et = function() {
    return s;
  })();
}
(function() {
  const s = Lt, t = Et();
  for (; ; )
    try {
      if (-parseInt(s(394)) / 1 * (-parseInt(s(402)) / 2) + parseInt(s(401)) / 3 + parseInt(s(396)) / 4 + parseInt(s(400)) / 5 * (parseInt(s(397)) / 6) + parseInt(s(393)) / 7 + parseInt(s(399)) / 8 + -parseInt(s(404)) / 9 * (parseInt(s(395)) / 10) === 533638)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
const I = { data: { localLastDocName: "topo_last_doc" }, connectPoint: { size: 14, style: { strokeStyle: "gray", fillStyle: "rgba(255,255,255,0.6)", lineWidth: 1, padding: 3 }, activeStyle: { lineWidth: 1, fillStyle: ce(403), padding: 1 }, unActiveStyle: { lineWidth: 1, fillStyle: "rgba(255,255,255,0.6)", padding: 3 }, drawStartMinDistance: 7, drawStartDelay: 50 }, connectBox: { anchorDist: 7, nodeDist: 7 }, nodeResizePoint: { width: 13, height: 13, style: { lineWidth: 1, strokeStyle: "gray", fillStyle: "#efefef", padding: 1 } }, nodeRotatePoint: { width: 14, height: 14, style: { lineWidth: 1, strokeStyle: "gray", fillStyle: "#efefef", padding: 1 }, rotateLineStyle: { strokeStyle: "gray", lineDash: [3, 3] }, rotateLineLength: 30 }, crossGuildLine: { styleH: { strokeStyle: "rgba(255,0,0,0.5)", lineWidth: 1 }, styleV: { strokeStyle: "rgba(0,255,0,0.5)", lineWidth: 1 }, axisInfoStyle: { color: "gray", fontSize: 16, fillStyle: "rgba(0,0,0,0)" } }, linkCtrlPoint: { size: 7, style: { lineWidth: 1, strokeStyle: "gray", fillStyle: ce(398), padding: 1 }, activeStyle: { globalAlpha: 0.2 }, unactiveStyle: { globalAlpha: 1 }, adjustStyle: { strokeStyle: "gray", fillStyle: "rgba(255,255,255,0.8)", lineWidth: 1, padding: 1 }, ctrlLinkStyle: { lineDash: [2, 2], lineWidth: 1, padding: 2 } }, dropBox: { style: { fillStyle: "rgba(0,0,0,0)", border: "3px solid orange", lineDash: [5, 3], lineWidth: 1 } }, align: { gridSize: 25, minDistance: 5, alignLineStyle: { strokeStyle: "cyan", lineDash: [5, 2], lineWidth: 1 } }, operationTip: { enable: !0 } }, xt = Pt;
(function() {
  const s = Pt, t = At();
  for (; ; )
    try {
      if (parseInt(s(367)) / 1 * (parseInt(s(365)) / 2) + parseInt(s(366)) / 3 + -parseInt(s(354)) / 4 * (parseInt(s(356)) / 5) + parseInt(s(355)) / 6 * (-parseInt(s(362)) / 7) + parseInt(s(360)) / 8 * (parseInt(s(357)) / 9) + parseInt(s(353)) / 10 * (parseInt(s(358)) / 11) + -parseInt(s(364)) / 12 === 898983)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
function Pt(s, t) {
  const e = At();
  return (Pt = function(n, i) {
    return e[n -= 353];
  })(s, t);
}
const H = navigator.userAgent.toUpperCase().indexOf("MAC OS") != -1 ? xt(363) : "Control";
function At() {
  const s = ["39858busNQk", "Meta", "31797132VGusSZ", "4Bjmnmz", "5341875nHlcVy", "88953uHyDiJ", "70ZfJKyE", "45916vKATba", "570WkgSBR", "75MlWXee", "9IAEzRO", "2625271HQGkJR", "ArrowDown", "5061608pOFxOs", "shift"];
  return (At = function() {
    return s;
  })();
}
const dt = { CtrlOrCmd: H, CreateGroup: H, DropTo_leader: "Shift", Delete: ["Delete", "Meta+Backspace"], Select_all: H + "+a", Select_invert: H + "+i", Cut: H + "+x", Copy: H + "+c", Paste: H + "+v", Save: H + "+s", Open: H + "+o", Undo: H + "+z", Redo: H + "+shift+z", Copy_style: "Shift+c", paste_Style: "Shift+v", Move_up: "ArrowUp", Move_down: xt(359), Move_left: "ArrowLeft", Move_right: "ArrowRight", Layout_tree: "t", Layout_grid: "g", LocalView: "/", ResizeKeepAspectRatio: xt(361), DrawLine: "l", Cancel: "Escape", DisableNodeAlign: "Alt" };
function be(s, t) {
  var e = Mt();
  return (be = function(n, i) {
    return e[n -= 330];
  })(s, t);
}
function Mt() {
  var s = ["285850DvEBBM", "69192coqWKH", "940YQTDzN", "99362aXeKOR", "36212FmefXU", "1McINTw", "1549744AXuwTl", "18vypfVO", "211257TkpZOK", "579188uftCwK", "8YMqCLS"];
  return (Mt = function() {
    return s;
  })();
}
(function() {
  for (var s = be, t = Mt(); ; )
    try {
      if (-parseInt(s(340)) / 1 * (parseInt(s(338)) / 2) + -parseInt(s(336)) / 3 + -parseInt(s(333)) / 4 + parseInt(s(335)) / 5 * (-parseInt(s(331)) / 6) + parseInt(s(330)) / 7 + parseInt(s(334)) / 8 * (parseInt(s(332)) / 9) + -parseInt(s(337)) / 10 * (-parseInt(s(339)) / 11) === 165261)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class z extends ve {
  constructor(t, e) {
    super(t, e);
  }
}
const L = pt;
(function() {
  const s = pt, t = Ht();
  for (; ; )
    try {
      if (parseInt(s(405)) / 1 * (-parseInt(s(407)) / 2) + -parseInt(s(413)) / 3 + -parseInt(s(396)) / 4 * (-parseInt(s(420)) / 5) + -parseInt(s(399)) / 6 * (parseInt(s(404)) / 7) + parseInt(s(398)) / 8 * (parseInt(s(400)) / 9) + parseInt(s(426)) / 10 * (parseInt(s(411)) / 11) + parseInt(s(415)) / 12 === 537752)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
const Pe = { lt: b.rb, ct: b.cb, rt: b.lb, rm: b.lm, rb: b.lt, cb: b.ct, lb: b.rt, lm: b.rm, center: b.center };
function Ht() {
  const s = ["3155vIwHnA", "width", "editor", "s_resize", "_anchorToLocalPoint", "w_resize", "7290830hPCVYP", "sw_resize", "_positionToLocalPoint", "nodeResizePoint", "pointerdownHandler", "3284HFIMzp", "pointermoveHandler", "8tNWmYK", "18SfxjBm", "84609yeSzYx", "pointeroutHandler", "invert", "dragHandler", "2125221QJeyte", "2597utnBlQ", "getWorldTransform", "90tSpFUW", "adjustFixedDirection", "xInWorld", "pointerupHandler", "11JOXWRd", "height", "2455425fjduRw", "nodeResizeBox", "13528392diVlPu", "dispatchEvent", "e_resize", "point", "handleNodeResize"];
  return (Ht = function() {
    return s;
  })();
}
function pt(s, t) {
  const e = Ht();
  return (pt = function(n, i) {
    return e[n -= 392];
  })(s, t);
}
class Ae extends St {
  constructor(t, e) {
    const n = pt;
    super(), this.nodeResizeBox = t, this.editor = t.editor, this.stage = this.editor.stage, this.selectedGroup = this.stage.selectedGroup, this.resize(I[n(394)].width, I.nodeResizePoint.height), this.setStyles(I.nodeResizePoint.style), this.name = e;
  }
  [L(397)]() {
    const t = L;
    let e, n = this.name;
    n == b.lt ? e = S.nw_resize : n == b.ct ? e = S.n_resize : n == b.rt ? e = S.ne_resize : n == b.lm ? e = S[t(425)] : n == b.rm ? e = S[t(417)] : n == b.lb ? e = S[t(392)] : n == b.cb ? e = S[t(423)] : n == b.rb && (e = S.se_resize), this.editor.stage.setCursor(e);
  }
  [L(424)](t, e) {
    return t[L(393)](e);
  }
  [L(403)](t) {
    const e = L;
    let n = this.nodeResizeBox[e(422)], i = this.nodeResizeBox.currNode;
    this.handleNodeResize(i, t, n);
  }
  [L(419)](t, e, n) {
    const i = L;
    let o = this.name, r = t.getWorldTransform(), a = e[i(409)], l = e.yInWorld, c = r.point(this._anchorToLocalPoint(t, o)), h = a - c.x, d = l - c.y, p = r[i(402)]().vec([0, 0], [h, d]);
    if (h = p[0], d = p[1], o == b.lt ? (h = -h, d = -d) : o == b.ct ? (h = 0, d = -d) : o == b.rt ? d = -d : o == b.lm ? (h = -h, d = 0) : o == b.rm ? d = 0 : o == b.lb ? h = -h : o == b.cb ? h = 0 : b.rb, n.keyboard.isKeydown(dt.ResizeKeepAspectRatio) && (d = h * (t[i(412)] / (t[i(421)] || 1))), this[i(408)](t, [h, d], o, r), h != 0 && d != 0 && n.hasListener("resize")) {
      let u = new z("resize", { target: t, details: { dx: h, dy: d, ctrl: o } });
      n[i(416)](u);
    }
  }
  adjustFixedDirection(t, e, n, i) {
    const o = L;
    let r = Pe[n], a = this[o(424)](t, r);
    a = i[o(418)](a), t.resizeWith(e[0], e[1]), t.width < 0 && (t.width = 0), t.height < 0 && (t.height = 0), t.updateMatrix();
    let l = t[o(406)](), c = this[o(424)](t, r);
    c = l.point(c);
    let h = a.x - c.x, d = a.y - c.y;
    t.translateWith(h, d), this[o(414)].updateSize();
  }
  pointerenterHandler() {
  }
  [L(401)](t) {
  }
  [L(395)](t) {
    t.preventDefault();
  }
  [L(410)](t) {
    t.preventDefault();
  }
}
function zt() {
  const s = ["target", "preventDefault", "getWorldTransform", "getRotationWithMouse", "setStyles", "2579934FHFOTZ", "1014538POcsDC", "427398KTNTfC", "originPosition", "808620zioxIE", "1121215YFCfZA", "stage", "inputSystem", "event", "setCursor", "rotation", "2DZodRO", "yInWorld", "nodeRotatePoint", "6401244eCriRb", "4625272etieml", "width"];
  return (zt = function() {
    return s;
  })();
}
function V(s, t) {
  const e = zt();
  return (V = function(n, i) {
    return e[n -= 382];
  })(s, t);
}
(function() {
  const s = V, t = zt();
  for (; ; )
    try {
      if (parseInt(s(398)) / 1 + -parseInt(s(386)) / 2 * (-parseInt(s(399)) / 3) + -parseInt(s(401)) / 4 + -parseInt(s(402)) / 5 + -parseInt(s(389)) / 6 + parseInt(s(397)) / 7 + parseInt(s(390)) / 8 === 610453)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Me extends St {
  constructor(t, e) {
    const n = V;
    super(), this.editor = t.editor, this.stage = this.editor.stage, this.selectedGroup = this[n(403)].selectedGroup, this[n(396)](I[n(388)].style), this.resize(I[n(388)][n(391)], I.nodeRotatePoint.height), this.name = e;
  }
  getRotationWithMouse(t, e) {
    const n = V;
    let i = e[n(382)], o = { x: 0, y: 0 }, r = t._shape.getConnectionAnchor(t[n(400)]);
    r != null && (o = Ct.calcPointByAnchor(t, r));
    let a = t[n(394)]().point(o);
    return Math.atan2(i[n(387)] - a.y, i.xInWorld - a.x);
  }
  pointermoveHandler() {
    this.stage.setCursor(S.move);
  }
  pointerdownHandler(t) {
    const e = V;
    t.preventDefault();
    let n = this.stage;
    if (this.selectedGroup.getTopObjects().length == 0)
      throw new Error("selectedGroup.length is 0!");
    let i = n.inputSystem[e(392)];
    this.elementInitAngle = i[e(385)], this.mouseInitAngle = this[e(395)](i, n);
  }
  pointerupHandler(t) {
    const e = V;
    this.stage[e(384)](S.auto), t[e(383)][e(393)]();
  }
  dragHandler(t) {
    const e = V;
    t[e(383)][e(393)]();
    let n = this.parent, i = n.editor, o = i.stage, r = o.inputSystem.target, a = this.getRotationWithMouse(r, o) - this.mouseInitAngle;
    if (r.rotate(this.elementInitAngle + a), n.updateSize(), a != 0 && i.hasListener("rotate")) {
      let l = new z("rotate", { target: r, details: { dAngle: a } });
      i.dispatchEvent(l);
    }
  }
}
function me(s, t) {
  const e = Bt();
  return (me = function(n, i) {
    return e[n -= 120];
  })(s, t);
}
function Bt() {
  const s = ["2941728jyezWT", "3940585UoWSaM", "7mhbFIX", "3272796pDaImE", "14096NwwOTE", "560qZCzSX", "87786wTPmGN", "4132110zESpOv", "21658DupGep", "1778iSkopP"];
  return (Bt = function() {
    return s;
  })();
}
(function() {
  const s = me, t = Bt();
  for (; ; )
    try {
      if (-parseInt(s(120)) / 1 * (-parseInt(s(126)) / 2) + -parseInt(s(125)) / 3 + parseInt(s(121)) / 4 + parseInt(s(129)) / 5 + parseInt(s(128)) / 6 + parseInt(s(127)) / 7 * (parseInt(s(122)) / 8) + -parseInt(s(124)) / 9 * (parseInt(s(123)) / 10) === 696361)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
const ut = { ZIndex: { LinkCtrlBox: 10002, NodeCtrlBox: 10001, IntersectPoint: 10003, EditorNewLink: 3 } }, O = tt;
function tt(s, t) {
  const e = Ot();
  return (tt = function(n, i) {
    return e[n -= 425];
  })(s, t);
}
(function() {
  const s = tt, t = Ot();
  for (; ; )
    try {
      if (parseInt(s(453)) / 1 * (-parseInt(s(437)) / 2) + -parseInt(s(427)) / 3 * (-parseInt(s(431)) / 4) + parseInt(s(456)) / 5 * (parseInt(s(435)) / 6) + parseInt(s(433)) / 7 + -parseInt(s(430)) / 8 + parseInt(s(449)) / 9 * (parseInt(s(447)) / 10) + -parseInt(s(439)) / 11 * (-parseInt(s(442)) / 12) === 299004)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class He extends w {
  constructor(t, e = 0, n = 0, i = 1, o = 1) {
    const r = tt;
    super(null, e, n, i, o), this.resizePoints = [], this.zIndex = ut[r(444)].NodeCtrlBox, this[r(441)] = t, this.pointerEnabled = !1, this[r(434)](), this[r(426)]();
  }
  initCtrlPoints() {
    const t = tt;
    let e = this, n = new Me(this, t(443));
    this[t(445)](n), this[t(457)] = n;
    let i = new v();
    i.setStyles(I.nodeRotatePoint.rotateLineStyle), i.pointerEnabled = !1, this.rotateLink = i, this[t(445)](i), this.rotateLink = i, ["lt", "lb", "rt", "rb"].forEach((o) => {
      let r = new Ae(this, o);
      e.resizePoints.push(r);
    }), this.addChildren(this.resizePoints);
  }
  [O(454)](t, e) {
    return t._positionToLocalPoint(e);
  }
  [O(446)](t) {
    const e = O;
    if (t != null) {
      if (!function(n) {
        let i = n.parent;
        return i instanceof v && (i.beginArrow === n || i.endArrow === n);
      }(t)) {
        if (!this.editor.isEditable(t))
          throw new Error("attach not Node or not editable");
        this.currNode = t, this.updateSize(), this[e(436)]();
      }
    } else
      this.clearTarget();
  }
  [O(450)]() {
    const t = O;
    let e = this.currNode;
    if (e == null || e[t(452)] == 0 || e.parent == null)
      return this[t(425)] = null, void this.hide();
    let n = this.editor.stage.camera, i = this.currNode;
    i.updateMatrix();
    let o = n.getObjectScreenTransform(i);
    {
      let r = this._anchorToLocalPoint(i, b.ct), a = o.point(r);
      r.y -= I.nodeRotatePoint.rotateLineLength, r = o[t(451)](r), this.rotateLink.setBegin(a), this.rotateLink[t(440)](r), this.rotateNode.translate(r.x, r.y);
    }
    for (let r = 0; r < this.resizePoints[t(428)]; r++) {
      let a = this.resizePoints[r], l = this._anchorToLocalPoint(i, a.name);
      l = o.point(l), a[t(455)](l.x, l.y);
    }
  }
  [O(429)]() {
    const t = O;
    super.update(), this[t(432)] && this.currNode != null && this.updateSize();
  }
  [O(448)]() {
    this[O(425)] = null, this.hide();
  }
  [O(438)]() {
  }
  pointerenterStageHandler() {
  }
}
function Ot() {
  const s = ["currNode", "initCtrlPoints", "152043GTUMBt", "length", "update", "3100720zGngEN", "28Negstf", "visible", "3591546UOygVh", "hide", "301110krFHlA", "show", "2pgELKh", "pointeroutStageHandler", "77sLWffg", "setEnd", "editor", "234924dMMCdd", "rotate", "ZIndex", "addChild", "attachTo", "157490rpNRMf", "clearTarget", "18WcquBj", "updateSize", "point", "isSelected", "500343lFWlNs", "_anchorToLocalPoint", "translate", "15DtncHB", "rotateNode"];
  return (Ot = function() {
    return s;
  })();
}
function _t() {
  const s = ["24926520JsFjVi", "canConnectAnchorProxy", "6zjvCks", "isActive", "setEnd", "linkCtrlPoint", "attachedLink", "updateMatrix", "findConnectableEndpoint", "name", "1104228YBTtOm", "LinkEnd", "auto", "end", "unactiveStyle", "parent", "anchor", "9orYhYG", "host", "6696680CsVUAU", "inputSystem", "active", "701428KrRPHf", "begin", "1187944dpiVZx", "worldToLocalXY", "editor", "pointermoveHandler", "11804712dUDaDc", "activeStyle", "xInWorld", "7ENyxZi", "unActive", "6243546bfTcWH", "11XbnfXg", "isDragStart", "stage", "LinkBegin", "dragHandler", "setCursor", "_upgradeParent", "setStyles"];
  return (_t = function() {
    return s;
  })();
}
const _ = gt;
function gt(s, t) {
  const e = _t();
  return (gt = function(n, i) {
    return e[n -= 103];
  })(s, t);
}
(function() {
  const s = gt, t = _t();
  for (; ; )
    try {
      if (parseInt(s(105)) / 1 + -parseInt(s(135)) / 2 * (-parseInt(s(127)) / 3) + -parseInt(s(107)) / 4 + parseInt(s(144)) / 5 + parseInt(s(116)) / 6 * (-parseInt(s(114)) / 7) + parseInt(s(111)) / 8 * (parseInt(s(142)) / 9) + -parseInt(s(125)) / 10 * (parseInt(s(117)) / 11) === 790352)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class ze extends St {
  constructor(t, e) {
    const n = gt;
    super(), this.isConnectPoint = !0, this[n(128)] = !1, this.anchor = e, this.linkCtrlBox = t, this.setRadius(I.linkCtrlPoint.size), this.editor = this.linkCtrlBox[n(109)], this.setStyles(I[n(130)].style);
  }
  [_(104)]() {
    const t = _;
    this.setStyles(I.linkCtrlPoint[t(112)]), this.isActive = !0;
  }
  [_(115)]() {
    const t = _;
    this[t(124)](I[t(130)][t(139)]), this.isActive = !1;
  }
  pointermoveHandler(t) {
    const e = _;
    this.editor.connectBox.hide();
    let n = this.parent[e(131)], i = this.editor[e(119)], o = n.parent[e(108)](i.inputSystem.xInWorld, i.inputSystem.yInWorld);
    this.anchor.pointermoveHandler(n, i, o);
  }
  pointerdownHandler(t) {
    const e = _;
    this[e(109)].stage[e(122)](S[e(137)]), this.canConnectAnchorProxy = null;
  }
  [_(121)](t) {
    const e = _;
    let n = this[e(140)], i = n.parent.stage;
    const o = this.editor;
    let r = n.attachedLink;
    o.connectBox.hide();
    const a = this.name, l = this[e(141)];
    t[e(118)] && l.usage & q.ADJUST && this.active();
    let c = r[e(140)].worldToLocalXY(i.inputSystem[e(113)], i[e(103)].yInWorld);
    if (a == A[e(120)] || a == A.LinkEnd)
      return l[e(110)](r, i, c), void (this.canConnectAnchorProxy = o.connectBox[e(133)]([r]));
    l.pointermoveHandler(r, i, c), n.update();
  }
  pointerupHandler(t) {
    const e = _;
    this.editor[e(119)][e(122)](S[e(137)]), t.event.preventDefault();
    let n = this.parent.attachedLink, i = this.anchor[e(134)];
    if (this.canConnectAnchorProxy != null && !this.canConnectAnchorProxy.equals(n.begin) && !this.canConnectAnchorProxy.equals(n.end)) {
      let o = this.canConnectAnchorProxy, r = o[e(143)];
      if (r.isLink) {
        let a = r;
        a[e(138)].host !== n && a[e(106)].host !== n && (i == A[e(120)] ? n.setBegin(o) : i == A.LinkEnd && n[e(129)](o), n[e(123)](), n.updateMatrix());
      } else
        i == A.LinkBegin ? n.setBegin(o) : i == A[e(136)] && n[e(129)](o), n._upgradeParent(), n[e(132)]();
    }
    this[e(128)] && this.unActive(), this[e(126)] = null;
  }
}
const N = ft;
function ft(s, t) {
  const e = Nt();
  return (ft = function(n, i) {
    return e[n -= 318];
  })(s, t);
}
function Nt() {
  const s = ["zIndex", "attachedLink", "2086080pZWvtu", "164100ZpoOOB", "3873457qBXoCp", "4vnyxnZ", "1801917cewekO", "ctrlLine", "clear", "ZIndex", "map", "editor", "values", "9DggGzI", "get", "stage", "from", "getAnchor", "ctrlPointMap", "setStyles", "visible", "updateCtrlPoints", "1117260hgMavC", "attachTo", "573310xJVntN", "name", "anchorNameStr", "8AIszFp", "CONNECT_EDIT", "join", "4163577yfxAnK", "LinkCtrlBox", "translate", "length", "_createCtrlLink", "8figmvy", "hide", "init"];
  return (Nt = function() {
    return s;
  })();
}
(function() {
  const s = ft, t = Nt();
  for (; ; )
    try {
      if (-parseInt(s(346)) / 1 * (-parseInt(s(352)) / 2) + parseInt(s(355)) / 3 * (parseInt(s(354)) / 4) + -parseInt(s(333)) / 5 + parseInt(s(351)) / 6 + -parseInt(s(353)) / 7 * (parseInt(s(338)) / 8) + -parseInt(s(324)) / 9 * (-parseInt(s(335)) / 10) + -parseInt(s(341)) / 11 === 506740)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Be extends w {
  constructor(t) {
    const e = ft;
    super(), this.ctrlPointMap = /* @__PURE__ */ new Map(), this[e(349)] = ut[e(320)][e(342)], this[e(322)] = t, this[e(348)]();
  }
  [N(334)](t) {
    const e = N;
    this.createCtrlPoints(t), this[e(332)](), this.show();
  }
  createCtrlPoint(t) {
    let e = new ze(this, t);
    return e.name = t.name, this.addChild(e), e;
  }
  updateSize() {
    const t = N, e = this[t(322)].stage.inputSystem.target;
    this.attachedLink && this[t(350)].parent != null ? this.attachedLink.parent == null || e == null || this.attachedLink != e ? (this.attachedLink = null, this.hide()) : this.attachTo(this.attachedLink) : this[t(347)]();
  }
  createCtrlPoints(t) {
    const e = N;
    this.removeAllChildren(), this.ctrlPointMap[e(319)](), this[e(350)] = t;
    let n = Array[e(327)](t.getShape().getAnchors()[e(323)]()).filter((o) => o.usage & q.ADJUST), i = n[e(321)]((o) => o[e(336)]);
    this[e(337)] = i[e(340)](",");
    for (let o = 0; o < n[e(344)]; o++) {
      let r = n[o], a = r[e(336)], l = this.createCtrlPoint(r);
      this.ctrlPointMap.set(a, l);
    }
    for (let o of this.ctrlPointMap.values()) {
      let r = o.anchor, a = r.name;
      if (r.usage != (q[e(339)] | q.ADJUST) && (o.setStyles(I.linkCtrlPoint.adjustStyle), o.isConnectPoint = !1), a == A.QuadBezierLinkCtrlPoint) {
        let l = this.ctrlPointMap[e(325)](A.LinkBegin), c = this._createCtrlLink(o.getAnchor(b.center), l[e(328)](b.center));
        o[e(318)] = c;
      } else if (a == A.BezierLinkCtrlPoint1) {
        let l = this.ctrlPointMap.get(A.LinkBegin), c = this[e(345)](o[e(328)](b.center), l.getAnchor(b.center));
        o[e(318)] = c;
      } else if (a == A.BezierLinkCtrlPoint2) {
        let l = this[e(329)].get(A.LinkEnd), c = this._createCtrlLink(o[e(328)](b.center), l.getAnchor(b.center));
        o.ctrlLine = c;
      }
    }
  }
  _createCtrlLink(t, e) {
    const n = N;
    let i = new v(null, t, e);
    return i[n(330)](I.linkCtrlPoint.ctrlLinkStyle), this.addChild(i), i.pointerEnabled = !1, i;
  }
  [N(332)]() {
    const t = N, e = this[t(350)];
    let n = this[t(322)][t(326)].camera.getObjectScreenTransform(e);
    for (let i of this.ctrlPointMap.values()) {
      let o = i.anchor, r = Ct.calcPointByAnchor(e, o), a = n.pointXY(r.x, r.y);
      i[t(343)](a.x, a.y);
    }
  }
  update() {
    const t = N;
    super.update(), this[t(331)] && this[t(350)] != null && this[t(332)]();
  }
  clearTarget() {
    const t = N;
    this.ctrlPointMap[t(319)](), this.removeAllChildren(), this.hide();
  }
  init() {
    this.ctrlPointMap.clear(), this.hide();
  }
  pointeroutStageHandler() {
  }
  pointerenterStageHandler() {
  }
}
const G = ot;
function jt() {
  const s = ["96778LVWFVJ", "unactive", "setCursor", "beginAnchorProxy", "activedPoint", "instanceManager", "lineDrawn", "setStyles", "connectPoint", "xInWorld", "buttons", "link", "length", "setEnd", "update", "7312GOQuAI", "1116DFLzzp", "942786vxQtxt", "13YnekeG", "editor", "resize", "272150YZpvJJ", "auto", "worldToLocalXY", "inputSystem", "320OHikUL", "connectBox", "distance", "begin", "3805830VKPhoa", "53700qEEfyx", "33yftEuC", "parent", "pointeroutHandler", "drawStartMinDistance", "size", "scale", "970456ZPhYFO", "drawStartInfo", "stage", "now"];
  return (jt = function() {
    return s;
  })();
}
(function() {
  const s = ot, t = jt();
  for (; ; )
    try {
      if (parseInt(s(289)) / 1 * (parseInt(s(312)) / 2) + -parseInt(s(288)) / 3 + parseInt(s(308)) / 4 + parseInt(s(296)) / 5 * (parseInt(s(301)) / 6) + -parseInt(s(300)) / 7 + parseInt(s(286)) / 8 * (-parseInt(s(287)) / 9) + -parseInt(s(292)) / 10 * (parseInt(s(302)) / 11) === 391538)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
var he, Oe = Object.defineProperty, _e = Object.getOwnPropertyDescriptor;
function ot(s, t) {
  const e = jt();
  return (ot = function(n, i) {
    return e[n -= 275];
  })(s, t);
}
class ht extends w {
  constructor(t, e = 0, n = 0, i = 1, o = 1, r) {
    const a = ot;
    super(null, e, n, i, o), this.isActive = !1, this.isIntersectPoint = !1, this.connectBox = t, this.editor = t.editor, this.stage = this.editor[a(310)], this[a(291)](I.connectPoint[a(306)], I.connectPoint.size), this[a(278)](I[a(279)].style), this[a(313)](), this.anchor = r;
  }
  setIntersect(t) {
    this.intersect = t;
  }
  pointerenterHandler() {
    this.active();
  }
  [G(304)]() {
    const t = G;
    this.stage[t(314)](S.auto), this.unactive();
  }
  pointermoveHandler() {
  }
  pointerdownHandler() {
    const t = G;
    event.preventDefault(), this.editor.stage.setCursor(S[t(293)]), this.link = null;
  }
  dragHandler(t) {
    const e = G;
    if (t[e(281)] == 2)
      return;
    const n = this.editor, i = n[e(310)];
    this[e(297)].activedPoint && this.connectBox[e(275)].unactive();
    const o = this[e(297)].target;
    if (t.isDragStart) {
      let r;
      if (this.isIntersectPoint) {
        let a = this.connectBox.intersect;
        r = o.getSegmentAnchor(a.t, a.segIndex);
      } else
        r = o.getAnchor(this.name);
      this[e(309)] = { x: t.x, y: t.y, beginAnchorProxy: r, timeStamp: Date[e(311)]() };
    } else {
      if (this[e(309)] != null) {
        let r = Q[e(298)](this.drawStartInfo.x, this[e(309)].y, t.x, t.y);
        if (Date.now() - this[e(309)].timeStamp > I.connectPoint.drawStartDelay && r > I.connectPoint[e(305)]) {
          this.editor.record("绘制新线");
          let a = { x: i.inputSystem.xInWorld, y: i.inputSystem.yInWorld };
          const l = n.instanceManager[e(277)](o, a, this.drawStartInfo[e(315)]);
          this.link = l;
          let c = l.parent[e(294)](i[e(295)][e(280)], i[e(295)].yInWorld);
          l.setEnd(c), this[e(309)] = null;
        }
      }
      if (this.link != null && this.link.end != null) {
        let r = this.link[e(303)].worldToLocalXY(i.inputSystem.xInWorld, i.inputSystem.yInWorld);
        this.link[e(284)](r), this.anchorProxy = this.connectBox.findConnectableEndpoint([this.link, this.link.end.host]);
      }
    }
  }
  pointerupHandler(t) {
    const e = G;
    this.show(), this.editor[e(285)](), this.editor.stage.setCursor(S.auto), this.link != null && (this.anchorProxy && (this.anchorProxy.equals(this.link[e(299)]) ? this.link.removeFromParent() : (this[e(282)][e(284)](this.anchorProxy), this.link._upgradeParent(), this.editor[e(276)].lineDrawingFinished(this.link))), this[e(290)].recordEnd("绘制新线")), this.link = null;
  }
  active() {
    const t = G;
    this.isActive = !0, this.setStyles(I[t(279)].activeStyle), this[t(307)](1.2, 1.2);
  }
  unactive() {
    const t = G;
    this.isActive = !1, this[t(278)](I.connectPoint.unActiveStyle), this[t(307)](1, 1);
  }
}
((s, t, e, n) => {
  const i = ot;
  for (var o, r = n > 1 ? void 0 : n ? _e(t, e) : t, a = s[i(283)] - 1; a >= 0; a--)
    (o = s[a]) && (r = (n ? o(t, e, r) : o(r)) || r);
  n && r && Oe(t, e, r);
})([(he = mt.getShape("Ellipse"), (s, t) => {
  s[t] = he;
})], ht.prototype, "_shape", 2);
const lt = Dt;
function Dt(s, t) {
  const e = Wt();
  return (Dt = function(n, i) {
    return e[n -= 308];
  })(s, t);
}
(function() {
  const s = Dt, t = Wt();
  for (; ; )
    try {
      if (-parseInt(s(308)) / 1 + -parseInt(s(313)) / 2 + parseInt(s(323)) / 3 + -parseInt(s(310)) / 4 + -parseInt(s(316)) / 5 * (-parseInt(s(318)) / 6) + -parseInt(s(315)) / 7 * (-parseInt(s(311)) / 8) + parseInt(s(314)) / 9 * (parseInt(s(317)) / 10) === 494699)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class U {
  static [lt(324)](t) {
    const e = lt;
    return t._obb != null && t._obb.points != null && t._obb[e(309)].length >= 2;
  }
  static connectable(t, e, n) {
    return U.isUpdateMatrixed(t) && n.indexOf(t) == -1 && e.isConnectable(t);
  }
  static aliagnAble(t, e) {
    const n = lt;
    return (i) => i.isNode && i !== e && i !== i.parent[n(322)] && i !== i.parent[n(319)] && i !== i.parent.label;
  }
  static isAlignable(t) {
    const e = lt;
    return !(t.keyboard.isKeydown(dt[e(321)]) || t.stage.selectedGroup[e(320)][e(312)] > 1);
  }
}
function Wt() {
  const s = ["952587WMRKCL", "173747VisQED", "11845UjEztN", "40AIzNoJ", "2502ElCYtx", "endArrow", "objects", "DisableNodeAlign", "beginArrow", "2532477xxVbrH", "isUpdateMatrixed", "897371WRSKVZ", "points", "1345340Sobisp", "16xntPXq", "length", "1153282WeKCtK"];
  return (Wt = function() {
    return s;
  })();
}
const k = yt;
function Rt() {
  const s = ["274878KPdMiq", "getNearestPoint", "getConnectionAnchors", "activePointByName", "1674QcfajD", "intersectPoint", "CONNECT_EDIT", "target", "sort", "displayList", "getCurrentLayer", "ctrlIntersectPoint", "315780lFwzyq", "MAX_SAFE_INTEGER", "1102915QlQZVM", "yInWorld", "pointeroutStageHandler", "activedPoint", "dist", "distance", "1979744GyfYJW", "editor", "_shape", "1082340FRuncp", "translate", "camera", "segIndex", "isControlDown", "unknow intersect object:", "648249nipHsQ", "isIntersectPoint", "6qqgske", "isConnectable", "setTarget", "name", "getObjectsIntersect", "map", "nodeDist", "length", "calcPointByAnchor", "getCenter", "showIntersectAnchor", "forEach", "stage"];
  return (Rt = function() {
    return s;
  })();
}
function yt(s, t) {
  const e = Rt();
  return (yt = function(n, i) {
    return e[n -= 202];
  })(s, t);
}
(function() {
  const s = yt, t = Rt();
  for (; ; )
    try {
      if (-parseInt(s(229)) / 1 * (-parseInt(s(202)) / 2) + -parseInt(s(210)) / 3 + parseInt(s(221)) / 4 + -parseInt(s(212)) / 5 + parseInt(s(242)) / 6 + -parseInt(s(227)) / 7 + parseInt(s(218)) / 8 === 150438)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Ne extends w {
  constructor(t, e = 0, n = 0, i = 1, o = 1) {
    const r = yt;
    super(null, e, n, i, o), this[r(219)] = t;
    let a = new Se("intersectPoint", 0, -1);
    this[r(209)] = this.createAnchorPoint(r(203), a), this[r(209)].isIntersectPoint = !0, this.ctrlIntersectPoint.hide();
  }
  [k(231)](t) {
    const e = k;
    if (this.editor.isConnectable(t)) {
      if (this[e(205)] !== t) {
        if (this.target = t, t != null && (t instanceof w || t instanceof v)) {
          this.removeAllChildren(), this.addChild(this.ctrlIntersectPoint);
          let n = de(t);
          for (let i of n)
            this.createAnchorPoint(i.name, i);
        }
        this.adjustConnectNodes();
      }
      this.children[e(240)]((n) => n.unactive()), this.ctrlIntersectPoint.hide(), this.show();
    }
  }
  adjustConnectNodes() {
    const t = k;
    if (this.target == null || this.target.parent == null)
      return void this.clearTarget();
    const e = this.target;
    let n = this.editor.stage.camera.getObjectScreenTransform(e);
    const i = this.children;
    for (let o = 0; o < i[t(236)]; o++) {
      const r = i[o];
      if (!r[t(228)]) {
        if (r[t(232)] != null) {
          let a = r.anchor, l = Ct[t(237)](e, a), c = n.point(l);
          r.translate(c.x, c.y);
        }
      }
    }
  }
  setTargetWithName(t, e) {
    if (e == null)
      throw new Error("activeNameOrPoint is null");
    this.setTarget(t), this.activePointByName(e), this.show();
  }
  clearActived() {
    const t = k;
    this.activedPoint && this[t(215)].unactive(), this.ctrlIntersectPoint.hide();
  }
  [k(245)](t) {
    const e = k;
    this[e(215)] && this.activedPoint.unactive();
    let n = this.children.filter((i) => i[e(232)] == t)[0];
    this[e(215)] = n, n.active(), this.ctrlIntersectPoint.hide();
  }
  [k(239)](t) {
    const e = k;
    if (this.intersect = t, t == null)
      return void this[e(209)].hide();
    let n = t.t, i = t[e(224)];
    const o = this.target;
    let r = o.getLocalPoint(n, i), a = this.editor.stage[e(223)].getObjectScreenTransform(o).point(r);
    this.ctrlIntersectPoint[e(222)](a.x, a.y), this.ctrlIntersectPoint.setStyles(I.connectPoint.activeStyle), this.ctrlIntersectPoint.show();
  }
  createAnchorPoint(t, e) {
    const n = new ht(this, 0, 0, 1, 1, e);
    return n.name = t, n.connectBox = this, this.addChild(n), n;
  }
  [k(233)](t) {
    const e = k;
    let n = this.editor.stage, i = { x: n.inputSystem.xInWorld, y: n.inputSystem[e(213)] };
    const o = I.connectBox[e(235)];
    let r = Number[e(211)], a = null;
    for (let l = 0; l < t.length; l++) {
      const c = t[l];
      let h = R[e(243)](c, i);
      h[e(216)] < o && h.dist < r && (r = h.dist, h.object = c, a = h);
    }
    return a;
  }
  getConnectableEndpointFromObjects(t) {
    const e = k, n = this[e(219)], i = this, o = n[e(241)], r = o.inputSystem, a = { x: r.x, y: r.y }, l = this.getNearestAnchorOnObjects(o.camera, a, t, I.connectPoint.size / 2), c = n.keyboard[e(225)]();
    if (l.length == 0 && !c) {
      let d = function(p, u) {
        const g = k, m = p[g(208)](), y = { x: p.inputSystem.xInWorld, y: p.inputSystem[g(213)] };
        let x = m[g(207)].filter((M) => M.isNode), C = x[g(234)]((M, W) => {
          const B = g;
          let at = M._obb.aabb[B(238)]();
          return { index: W, dist: Q.distance(y.x, y.y, at.x, at.y) };
        });
        if (C = C.filter((M) => M.dist <= u), C.length == 0)
          return null;
        C[g(206)]((M, W) => M[g(216)] - W[g(216)]);
        let D = C[0].index;
        return x[D];
      }(o, 100);
      return this[e(219)][e(230)](d) && i.setTarget(d), null;
    }
    if (l.length > 0) {
      l.sort((m, y) => {
        let x = m.object, C = y.object;
        return c ? (x instanceof v ? 0 : 1) - (C instanceof v ? 0 : 1) : (x instanceof w ? 0 : 1) - (C instanceof w ? 0 : 1);
      });
      const d = l[0], p = d.object;
      let u = d.anchorName;
      const g = p.getAnchor(u);
      return i.setTargetWithName(p, u), g;
    }
    const h = this[e(233)](t);
    if (h != null) {
      const d = h.object;
      if (d instanceof w || d instanceof v) {
        i.setTarget(d);
        const p = d.getSegmentAnchor(h.t, h[e(224)]);
        return this.showIntersectAnchor(h), p;
      }
      throw new Error(e(226) + d);
    }
    return i.clearTarget(), null;
  }
  findConnectableEndpoint(t) {
    const e = this.editor, n = e.stage.camera.localView.getObject()._findChildren(function(i) {
      return U.connectable(i, e, t);
    }, !0);
    return this.getConnectableEndpointFromObjects(n);
  }
  getNearestAnchorOnObjects(t, e, n, i) {
    const o = k;
    let r = [];
    for (let a = 0; a < n[o(236)]; a++) {
      const l = n[a], c = t.getObjectScreenTransform(l);
      let h = de(l);
      for (let d of h) {
        let p = R.anchorToLocalPoint(l, d.name), u = c.point(p), g = Q[o(217)](u.x, u.y, e.x, e.y);
        if (g < i) {
          const m = { distance: g, object: l, anchorName: d[o(232)] };
          r.push(m);
        }
      }
    }
    return r.sort((a, l) => a.distance - l.distance), r;
  }
  update() {
    super.update(), this.adjustConnectNodes();
  }
  clearTarget() {
    this.target = null, this.hide();
  }
  cancel() {
  }
  [k(214)]() {
  }
  pointerenterStageHandler() {
  }
}
function de(s) {
  const t = k;
  let e = s[t(220)][t(244)](), n = [];
  for (let i of e)
    i.usage & q[t(204)] && n.push(i);
  return n;
}
function Gt(s, t) {
  const e = Ft();
  return (Gt = function(n, i) {
    return e[n -= 271];
  })(s, t);
}
const P = Gt;
function Ft() {
  const s = ["879580EThKYP", "checkHistoryLength", "12754smtvYx", "790532udVSPZ", "push", "undoHistory", "30rtSkYK", "1269672hkpSFm", "3064ATOjFX", "39hWKjPv", "修改属性", "redo", "length", "修改样式", "editor", "连线调整", "48TalNZt", "344187IgWgFU", "historyMaxLength", "undoFn", "8741447VhADnT", "86804vvrhfG", "20wZBtKh", "redoHistory"];
  return (Ft = function() {
    return s;
  })();
}
(function() {
  const s = Gt, t = Ft();
  for (; ; )
    try {
      if (-parseInt(s(276)) / 1 + parseInt(s(273)) / 2 * (parseInt(s(285)) / 3) + -parseInt(s(279)) / 4 * (parseInt(s(282)) / 5) + -parseInt(s(283)) / 6 + -parseInt(s(278)) / 7 * (parseInt(s(284)) / 8) + parseInt(s(293)) / 9 * (-parseInt(s(274)) / 10) + -parseInt(s(272)) / 11 * (-parseInt(s(292)) / 12) === 691632)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})(), P(291), P(289), P(286);
class je {
  constructor(t, e, n) {
    const i = P;
    this.type = t, this[i(271)] = n, this.redoFn = e;
  }
  [P(287)]() {
    this.redoFn();
  }
  undo() {
    this.undoFn();
  }
}
class De extends EventTarget {
  constructor(t) {
    const e = P;
    super(), this[e(294)] = 10, this[e(290)] = t, this.undoHistory = [], this[e(275)] = [];
  }
  clear() {
    const t = P;
    this.undoHistory = [], this[t(275)] = [];
  }
  [P(280)](t, e, n) {
    const i = P;
    let o = new je(t, e, n);
    return o.editor = this.editor, this.redoHistory.length = 0, this.undoHistory.push(o), this[i(277)](), o;
  }
  undo() {
    const t = P;
    if (this.undoHistory[t(288)] == 0)
      return null;
    let e = this.undoHistory.pop();
    return e.undo(), this.redoHistory[t(280)](e), this.checkHistoryLength(), e;
  }
  redo() {
    const t = P;
    if (this[t(275)][t(288)] == 0)
      return null;
    let e = this[t(275)].pop();
    return e[t(287)](), this[t(281)][t(280)](e), this.checkHistoryLength(), e;
  }
  checkHistoryLength() {
    const t = P;
    this.undoHistory.length > this.historyMaxLength && this[t(281)].shift(), this.redoHistory.length > this.historyMaxLength && this[t(275)].shift();
  }
}
function Vt() {
  const s = ["sort", "47852NuoFDt", "101430waJAdV", "279IsnZWy", "299400xGfIET", "348HDvamw", "2904580zwuOSt", "1177ulMcTl", "407199UhjvRO", "92WFwGmv", "20200MOSXCw", "3394EFvcex"];
  return (Vt = function() {
    return s;
  })();
}
(function() {
  const s = Yt, t = Vt();
  for (; ; )
    try {
      if (parseInt(s(166)) / 1 * (-parseInt(s(164)) / 2) + -parseInt(s(163)) / 3 + -parseInt(s(161)) / 4 + parseInt(s(159)) / 5 + parseInt(s(160)) / 6 * (parseInt(s(156)) / 7) + -parseInt(s(165)) / 8 * (parseInt(s(158)) / 9) + -parseInt(s(157)) / 10 * (-parseInt(s(162)) / 11) === 445392)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
const We = { getItem: function(s) {
  return localStorage.getItem(s);
}, setItem: function(s, t) {
  localStorage.setItem(s, t);
}, saveWithVersion(s, t) {
  s += Date.now(), this.setItem(s, t);
}, getAllVersions(s) {
  const t = Yt;
  return Object.keys(localStorage).filter((e) => e.startsWith(s))[t(167)]();
}, getLastVersion(s, t) {
  let e = this.getAllVersions(s).reverse();
  if (e.length == 0)
    return;
  t == null && (t = 0), t + 1 >= e.length && (t = e.length - 1);
  let n = e[t];
  return this.getItem(n);
} };
function Yt(s, t) {
  const e = Vt();
  return (Yt = function(n, i) {
    return e[n -= 156];
  })(s, t);
}
function Kt(s, t) {
  const e = Ut();
  return (Kt = function(n, i) {
    return e[n -= 256];
  })(s, t);
}
const vt = Kt;
function Ut() {
  const s = ["Move_up", "paste_Style", "368688VwMLVx", "isNode", "getCurrentLayer", "stage", "1136342mfHAhl", "Move_right", "styleCopyHandler", "2698368AkuOuR", "clearCtrlBoxs", "593175rlnVkL", "filter", "forEach", "Shift", "keyup", "pasteHandler", "layoutManager", "Move_left", "Select_all", "Copy", "LocalView", "8104824JqlYtK", "editor", "copyHandler", "getTopObjects", "Cut", "2470475mjrnsz", "6770910LcQOvp", "openLasted", "Redo", "onEsc", "showOpTooltip", "visible"];
  return (Ut = function() {
    return s;
  })();
}
(function() {
  const s = Kt, t = Ut();
  for (; ; )
    try {
      if (-parseInt(s(273)) / 1 + parseInt(s(277)) / 2 + parseInt(s(282)) / 3 + parseInt(s(280)) / 4 + -parseInt(s(264)) / 5 + -parseInt(s(265)) / 6 + parseInt(s(259)) / 7 === 607052)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})(), vt(285);
class Re {
  constructor(t) {
    this[vt(260)] = t, this.init();
  }
  init() {
    const t = vt, e = this.editor, n = e.stage, i = e[t(275)]();
    let o = e[t(276)].keyboard;
    const r = e.keyConfig;
    function a(l, c, h) {
      !Array.isArray(l) && (l = [l]), l.forEach((d) => {
        o.bindKey(d, function(p) {
          c(p);
        }, h);
      });
    }
    o.addEventListener(t(286), function(l) {
      e.update();
    }), a(r.Delete, (l) => e.editorEventManager.deleteHandler(l)), a(r[t(263)], (l) => e.clipboardManager.cutHandler(l)), a(r[t(257)], (l) => {
      const c = t;
      e.showOpTooltip("复制"), e.clipboardManager[c(261)](l);
    }), a(r.Paste, (l) => e.clipboardManager[t(287)](l)), a(r.Undo, (l) => {
      e.showOpTooltip("撤销"), e.redoUndoSys.undo(), e.clearCtrlBoxs();
    }), a(r[t(267)], (l) => {
      const c = t;
      e[c(269)]("重做"), e.redoUndoSys.redo(l), e[c(281)]();
    }), a(r[t(256)], (l) => {
      const c = t;
      e.showOpTooltip("全选");
      let h = n.camera.localView.getObject(), d = Ce.flatten(h.children, (p) => p[c(270)] == 1);
      n.select(d);
    }), a(r.Select_invert, (l) => {
      const c = t;
      e.showOpTooltip("反选");
      let h = n.selectedGroup.getTopObjects();
      n.select(i.displayList[c(283)]((d) => !h.includes(d)));
    }), a(r.Save, (l) => {
      e.showOpTooltip("保存"), e.saveHandler(l, e.imageToBase64);
    }, !1), a(r.Open, (l) => {
      const c = t;
      e[c(269)]("打开"), e[c(266)](l);
    }, !1), a(r[t(258)], (l) => {
      e.toogleLocalView();
    }), a(r.Copy_style, (l) => {
      const c = t;
      e[c(269)]("复制样式"), e.clipboardManager[c(279)](l);
    }, !1), a(r[t(272)], (l) => {
      e.showOpTooltip("粘贴样式"), e.clipboardManager.stylePasteHandler(l);
    }, !1), a(r[t(289)], (l) => {
      const c = t;
      n.selectedGroup[c(262)]().filter((h) => h[c(274)]).forEach((h) => {
        h.x -= 1;
      });
    }), a(r[t(278)], (l) => {
      const c = t;
      n.selectedGroup[c(262)]()[c(283)]((h) => h[c(274)]).forEach((h) => {
        h.x += 1;
      });
    }), a(r[t(271)], (l) => {
      n.selectedGroup.getTopObjects().filter((c) => c.isNode).forEach((c) => {
        c.y -= 1;
      });
    }), a(r.Move_down, (l) => {
      const c = t;
      n.selectedGroup[c(262)]().filter((h) => h[c(274)])[c(284)]((h) => {
        h.y += 1;
      });
    }), a(r.Layout_grid, (l) => {
      e[t(288)].doGridLayout();
    }), a(r.Cancel, (l) => {
      e[t(268)](l);
    });
  }
}
function Xt(s, t) {
  const e = Zt();
  return (Xt = function(n, i) {
    return e[n -= 133];
  })(s, t);
}
(function() {
  const s = Xt, t = Zt();
  for (; ; )
    try {
      if (parseInt(s(148)) / 1 * (parseInt(s(157)) / 2) + parseInt(s(144)) / 3 * (-parseInt(s(151)) / 4) + -parseInt(s(147)) / 5 * (-parseInt(s(138)) / 6) + parseInt(s(156)) / 7 * (-parseInt(s(154)) / 8) + -parseInt(s(153)) / 9 * (-parseInt(s(134)) / 10) + parseInt(s(140)) / 11 + -parseInt(s(135)) / 12 * (-parseInt(s(150)) / 13) === 694472)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
function Zt() {
  const s = ["左对齐", "20GhOeLx", "8951064wSmpco", "移至底部", "顶部对齐", "420942vcBbrm", "editorEventManager", "5637819lcnEzw", "stage", "下移一层", "changeLevel", "3eClvSy", "addEventListener", "evenSpacing", "10Ozxggq", "3911rzItgz", "layoutManager", "13rYUEfB", "3739236CYRYqr", "clipboardManager", "1431837YWzGGU", "3592nRbKhY", "align", "21427LKEBzw", "658KiShuH"];
  return (Zt = function() {
    return s;
  })();
}
var pe = et;
(function() {
  for (var s = et, t = Jt(); ; )
    try {
      if (-parseInt(s(471)) / 1 + -parseInt(s(465)) / 2 * (-parseInt(s(468)) / 3) + parseInt(s(469)) / 4 * (-parseInt(s(463)) / 5) + -parseInt(s(473)) / 6 + -parseInt(s(461)) / 7 + parseInt(s(472)) / 8 * (-parseInt(s(476)) / 9) + parseInt(s(467)) / 10 * (parseInt(s(464)) / 11) === 407720)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class bt {
  constructor() {
    this.take = 0;
  }
  copyPut(t) {
    var e = et;
    this[e(474)] = 0, this.type = e(462), this[e(475)] = t;
  }
  cutPut(t) {
    var e = et;
    this.take = -1, this.type = "cut", this[e(475)] = t;
  }
  [pe(470)]() {
    return this.take++, this.source;
  }
  isFirstCutPaste() {
    var t = pe;
    return this[t(466)] == "cut" && this[t(474)] == 0;
  }
  clear() {
    this.type = null, this.take = 0, this.source = null;
  }
}
function Jt() {
  var s = ["332154LRSWrU", "8uvAScA", "takeSource", "465761gpIvJL", "18320hjTiSP", "2516946nzXwtu", "take", "source", "2745EaMQpZ", "2564170TAVoTl", "copy", "713255bHOsGw", "968BMBRfq", "6nTPNrL", "type", "262600wmYdCW"];
  return (Jt = function() {
    return s;
  })();
}
function et(s, t) {
  var e = Jt();
  return (et = function(n, i) {
    return e[n -= 461];
  })(s, t);
}
function nt(s, t) {
  const e = qt();
  return (nt = function(n, i) {
    return e[n -= 226];
  })(s, t);
}
const j = nt;
function qt() {
  const s = ["粘贴样式", "forEach", "copySetStyle", "editor", "cutPut", "unlinks", "objects", "className", "943614kYRnPy", "494830ndxIzV", "inputSystem", "addChild", "clearTarget", "424362UiiTwE", "sourceObjArr", "length", "paste", "1152118gTNCYL", "takeSource", "stage", "247536GlYKZo", "copyPut", "camera", "4903712azTGoT", "linkCtrlBox", "clipboard", "stylePasteHandler", "_clearTarget", "parents", "getTopObjects", "styleCopyHandler", "copyHandler", "map", "getCenter", "cssClipBoard", "classList", "527088pMbrcI", "isEmpty", "5uMHHWO", "translateWith", "concat", "object", "copy"];
  return (qt = function() {
    return s;
  })();
}
(function() {
  const s = nt, t = qt();
  for (; ; )
    try {
      if (parseInt(s(241)) / 1 + parseInt(s(249)) / 2 + -parseInt(s(252)) / 3 + -parseInt(s(268)) / 4 + parseInt(s(227)) / 5 * (-parseInt(s(245)) / 6) + parseInt(s(240)) / 7 + -parseInt(s(255)) / 8 === 307716)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Ge {
  constructor(t) {
    const e = nt;
    this[e(266)] = new bt(), this[e(257)] = new bt(), this[e(266)] = new bt(), this[e(235)] = t;
  }
  reset() {
    const t = nt;
    this.clipboard.clear(), this[t(266)].clear();
  }
  [j(263)]() {
    const t = j;
    let e = this.editor.stage, n = [].concat(e.selectedGroup[t(261)]());
    if (n.length == 0)
      return;
    let i = n[t(264)]((r) => r.parent);
    this[t(257)][t(253)]({ type: t(238), parents: i, sourceObjArr: n });
    let o = new z(t(231), { target: n });
    this[t(235)].dispatchEvent(o);
  }
  cutHandler() {
    const t = j;
    let e = this.editor, n = e.stage, i = [][t(229)](n.selectedGroup.getTopObjects());
    if (i.length == 0)
      return;
    let o = i[t(264)]((a) => a.parent);
    this.clipboard[t(236)]({ type: t(238), parents: o, sourceObjArr: i }), e.record("剪切"), i[t(233)]((a, l) => {
      const c = t;
      o[l].removeChild(a), R[c(237)](a, i);
    }), e.recordEnd("剪切"), n[t(242)][t(259)](), e.connectBox[t(244)](), e.nodeResizeBox[t(244)](), e[t(256)].clearTarget();
    let r = new z("cut", { target: i });
    this.editor.dispatchEvent(r);
  }
  pasteHandler() {
    const t = j;
    let e = this[t(235)], n = e.stage.inputSystem, i = this.clipboard[t(250)]();
    if (i == null)
      return;
    let o = e.stage, r = i[t(246)], a = i[t(260)];
    a = a.map((m) => {
      const y = t;
      let x = o.camera.localView.object;
      return x == null || x.contains(m) ? m : o[y(254)].localView[y(230)];
    });
    let l = r.map((m) => m._obb.aabb), c = ye.unionRects(l)[t(265)](), h = n.xInWorld - c.x, d = n.yInWorld - c.y;
    e.record("粘贴");
    let p = r, u = o.serializerSystem.objectsToJSON(r);
    p = o.serializerSystem.jsonToObjects(u), p[t(233)]((m, y) => {
      m[t(228)](h, d);
    }), p.forEach((m, y) => {
      const x = t;
      a[y][x(243)](m);
    }), e.recordEnd("粘贴");
    let g = new z(t(248), { target: p });
    this[t(235)].dispatchEvent(g);
  }
  [j(262)]() {
    const t = j;
    let e = this[t(235)].stage, n = e.inputSystem.target;
    n == null && (!e.selectedGroup[t(226)]() && (n = e.selectedGroup.objects[0]), n == null) || this[t(266)].copyPut({ type: "style", parents: [n.parent], sourceObjArr: [n] });
  }
  [j(258)]() {
    const t = j;
    let e = this.editor, n = this.cssClipBoard.takeSource();
    if (n == null || n.sourceObjArr[t(247)] == 0)
      return;
    let i = e[t(251)].selectedGroup.objects, o = this;
    e.record(t(232));
    let r = n.sourceObjArr[0];
    i.forEach((a) => {
      o[t(234)](a, r);
    }), e.recordEnd("粘贴样式");
  }
  copySetStyle(t, e) {
    const n = j;
    if (t !== e && t[n(239)] == e[n(239)]) {
      for (let i = 0; i < e.classList[n(247)]; i++)
        t.classList[i] = e[n(267)][i];
      t.setStyles(e.style);
    }
  }
}
function Z(s, t) {
  const e = Qt();
  return (Z = function(n, i) {
    return e[n -= 334];
  })(s, t);
}
function Qt() {
  const s = ["zIndex", "dropBox", "42228VPgOcY", "ZIndex", "892332IGHsLJ", "10lacTnn", "getObjectScreenTransform", "3999788pCSqdu", "1184NDNOfy", "resize", "4113785qXWuHK", "3AIGvfw", "_positionToLocalPoint", "style", "5101999dvdMZK", "editor", "atan2", "height", "373516hqBGGN", "currObject", "translate", "98561hGxEJi", "310aYCpJD"];
  return (Qt = function() {
    return s;
  })();
}
(function() {
  const s = Z, t = Qt();
  for (; ; )
    try {
      if (parseInt(s(338)) / 1 * (-parseInt(s(345)) / 2) + parseInt(s(351)) / 3 * (parseInt(s(347)) / 4) + -parseInt(s(350)) / 5 + -parseInt(s(344)) / 6 + parseInt(s(354)) / 7 + parseInt(s(348)) / 8 * (-parseInt(s(342)) / 9) + -parseInt(s(339)) / 10 * (-parseInt(s(335)) / 11) === 622740)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Fe extends w {
  constructor(t, e = 0, n = 0, i = 1, o = 1) {
    const r = Z;
    super(null, e, n, i, o), this[r(340)] = ut[r(343)].NodeCtrlBox, this[r(355)] = t, this.setStyles(I[r(341)][r(353)]), this.pointerEnabled = !1, this[r(336)], this.hide();
  }
  update() {
    this.visible && this.currObject != null && this.updateSize();
  }
  attachTo(t) {
    const e = Z;
    return t == null || t instanceof w && !this.editor.isEditable(t) ? (this[e(336)] = null, void this.hide()) : (this.currObject = t, this.updateSize(), void this.show());
  }
  updateSize() {
    const t = Z;
    this[t(336)] != null && this.viewClone(this[t(336)]);
  }
  viewClone(t) {
    const e = Z;
    let n = this.editor.stage;
    if (t instanceof wt)
      return this[e(349)](n.width - 10, n[e(334)] - 10), this.rotate(0), void this.translate(0.5 * n.width, 0.5 * n[e(334)]);
    if (!(t instanceof v) && t instanceof w) {
      let i = n.camera[e(346)](t), o = i.point(t._positionToLocalPoint(b.center)), r = i.point(t[e(352)](b.rm)), a = Math[e(356)](r.y - o.y, r.x - o.x);
      i.rotate(-a);
      let l = i.point(t._positionToLocalPoint(b.center)), c = i.point(t._positionToLocalPoint(b.rb)), h = 2 * (c.x - l.x), d = 2 * (c.y - l.y), p = 4;
      this.resize(h + 2 * p, d + 2 * p), this.rotate(a), this[e(337)](o.x, o.y);
    }
  }
}
function ue(s, t) {
  const e = It;
  let n, i = s.stage[e(328)](), o = s.stage[e(336)], r = i.getAllNodes().filter((l) => {
    const c = e;
    let h = l;
    return h.visible && h[c(335)] != 1 && h[c(326)] && o.canSee(h);
  }), a = t.filter((l) => l[e(324)]() || l.parent === i);
  for (let l = 0; l < a[e(330)] && (n = Ve(a[l], r), n == null); l++)
    ;
  return n == null && (n = i, a = a.filter((l) => l.parent !== i)), { parent: n, objects: a };
}
function $t() {
  const s = ["isSelected", "camera", "6182fuovwx", "3165933zIFzRi", "parent", "161BFkRxd", "750sZkTeV", "321NbbDAR", "isOutOfParent", "253096YAXfsr", "pointerEnabled", "1264109FoWhQb", "getCurrentLayer", "3587448yoVKCh", "length", "9990wrovCz", "6057FdSESw", "9445RqliTC", "60gzfnUr"];
  return ($t = function() {
    return s;
  })();
}
function It(s, t) {
  const e = $t();
  return (It = function(n, i) {
    return e[n -= 321];
  })(s, t);
}
function Ve(s, t) {
  const e = s.getAABB(), n = t.filter((i) => i !== s[It(339)] && i !== s && !s.contains(i));
  for (let i = n.length - 1; i >= 0; i--) {
    const o = n[i];
    if (o.getAABB().isIntersectRect(e))
      return o;
  }
  return null;
}
(function() {
  const s = It, t = $t();
  for (; ; )
    try {
      if (parseInt(s(323)) / 1 * (parseInt(s(337)) / 2) + parseInt(s(338)) / 3 + -parseInt(s(329)) / 4 + -parseInt(s(333)) / 5 * (-parseInt(s(322)) / 6) + parseInt(s(321)) / 7 * (-parseInt(s(325)) / 8) + parseInt(s(332)) / 9 * (-parseInt(s(331)) / 10) + parseInt(s(327)) / 11 * (parseInt(s(334)) / 12) === 561402)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
const E = st;
function te() {
  const s = ["camera", "pointermoveHandler", "keyboard", "edit", "setTarget", "clearTarget", "isNode", "editor", "update", "addEventListener", "linkCtrlBox", "event", "record", "alignManager", "dropToBox", "getCenter", "modechange", "recordEnd", "handlerLayer", "length", "696ytPaPd", "_pickUp", "parent", "9801153lMzTyi", "recordInterrupt", "_dragHandler", "setCursor", "pointerdownHandler", "changeParent", "812310cjjmBB", "removeChild", "553941zdIvBm", "63ZQvUYb", "getCurrentLayer", "Control", "9MGfXdM", "isKeydown", "45460AMbnFb", "objects", "selectedGroup", "attachTo", "dragHandler", "pointeroutHandler", "dispatchEvent", "mousewheelHandler", "forEach", "10dZzQAB", "target", "crosshair", "50415HIvUOM", "connectBox", "removeAll", "isConnectable", "176264NEihzA", "mode", "toScreenRect", "mouseOverTarget", "pointerenterStageHandler", "isDragStart", "stage", "inputSystem", "getTopObjects", "_upgradeLinks", "对象拖拽"];
  return (te = function() {
    return s;
  })();
}
function st(s, t) {
  const e = te();
  return (st = function(n, i) {
    return e[n -= 180];
  })(s, t);
}
(function() {
  const s = st, t = te();
  for (; ; )
    try {
      if (-parseInt(s(234)) / 1 + -parseInt(s(240)) / 2 + parseInt(s(238)) / 3 * (parseInt(s(223)) / 4) + parseInt(s(188)) / 5 + parseInt(s(232)) / 6 + parseInt(s(235)) / 7 * (-parseInt(s(192)) / 8) + -parseInt(s(226)) / 9 * (-parseInt(s(185)) / 10) === 460039)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
const Ye = ae.w != null ? ae.w.charAt(3) : "1";
class Ke {
  constructor(t) {
    this.editor = t, this.init();
  }
  init() {
    const t = st;
    let e = this[t(210)], n = e[t(198)];
    n.inputSystem;
    let i = e[t(221)];
    n.camera.localView.mode == null && (n.addEventListener(t(219), function(o) {
      const r = t;
      let a = o[r(193)], l = e.nodeResizeBox, c = e.linkCtrlBox, h = e.dropToBox, d = e[r(189)];
      a == we[r(206)] ? (i.addChild(l), i.addChild(c), i.addChild(d), i.addChild(h)) : (i.removeChild(l), i[r(233)](c), i.removeChild(d), i.removeChild(h)), e.update();
    }), n.selectedGroup.addEventListener("dragend", function(o) {
      const r = t;
      e.selectedGroupDragHandler(o, n[r(242)].getTopObjects());
    }), n.selectedGroup[t(212)]("dragstart", function(o) {
      const r = t;
      e.selectedGroupDragEndHandler(o, n[r(242)][r(200)]());
    }));
  }
  deleteHandler() {
    const t = st;
    let e = this[t(210)], n = e[t(198)].selectedGroup;
    if (Ye != "1")
      return null;
    let i = n[t(200)]();
    n[t(190)](), e.connectBox[t(208)](), e.nodeResizeBox.clearTarget(), e[t(213)].clearTarget(), e.instanceManager.delete(i), e[t(182)](new z("delete", { target: i }));
  }
  [E(230)](t) {
    const e = E, n = this[e(210)];
    if (n.stage[e(236)]() == null)
      return void n._hideAllAttaches();
    const i = n.stage.inputSystem;
    let o = n.handlerLayer, r = n.nodeResizeBox, a = n.linkCtrlBox;
    n[e(216)].pointerdownHandler(i);
    let l = o[e(224)]();
    if (n.controlTarget = l, n[e(189)].hide(), l != null) {
      let c = l[e(225)];
      return c !== r ? r.hide() : c !== a && a.hide(), l[e(230)](i), void i[e(214)].preventDefault();
    }
    a.hide(), r.hide();
  }
  [E(183)](t) {
  }
  dblclickHandler(t) {
  }
  pointupHandler(t) {
    const e = E, n = this.editor, i = n.stage.inputSystem;
    n.alignManager.pointerupHandler(i);
    let o = n.stage, r = n.nodeResizeBox, a = n.linkCtrlBox, l = n.controlTarget;
    if (l != null)
      return i.isDragEnd && !(l instanceof ht) && n.recordEnd("控制点"), l.pointerupHandler(i), i[e(214)].preventDefault(), void n[e(211)]();
    if (i.button == 2)
      return;
    let c = o[e(199)].target;
    if (c != null ? (n.isEditable(c) && (c instanceof v ? a.attachTo(c) : c instanceof w && r.attachTo(c)), n[e(191)](c) && n.connectBox.setTarget(c)) : (n[e(189)].clearTarget(), r[e(208)](), a.clearTarget()), n.dropToBox.currObject != null) {
      let h = n.stage.selectedGroup.getTopObjects(), d = ue(n, h), p = d.parent;
      d[e(241)][e(184)]((u) => {
        const g = e;
        u[g(231)](p), Ie[g(201)](u).length;
      });
    }
    n[e(217)].attachTo(null);
  }
  [E(228)](t) {
    const e = E, n = this.editor, i = n.stage.inputSystem;
    if (i.buttons == 2)
      return;
    n.keyboard.isKeydown("Shift") && n.stage[e(229)](S[e(187)]);
    let o = n.controlTarget;
    if (o != null)
      return i.isDragStart && !(o instanceof ht) && n[e(215)]("控制点"), o[e(180)](i), i[e(214)] instanceof MouseEvent && i.event.defaultPrevented == 1 ? void 0 : void i[e(214)].preventDefault();
    n.alignManager[e(228)](i), n.dropToBox.hide();
    const r = n.keyConfig.DropTo_leader;
    if (n[e(198)].inputSystem[e(186)] && n[e(205)].isKeydown(r)) {
      let a = n.stage.selectedGroup[e(200)](), l = ue(n, a), c = l.parent;
      l.objects, c instanceof w && n.isEditable(c) ? n.dropToBox[e(243)](c) : c instanceof wt && n.dropToBox.attachTo(c);
    }
  }
  [E(204)](t) {
    const e = E, n = this.editor;
    let i = n.stage;
    const o = i[e(199)], r = i.handlerLayer;
    if (i.setCursor(S.auto), n.keyboard[e(239)](e(237)) && n.connectBox.findConnectableEndpoint([]))
      return;
    let a = r._pickUp();
    if (a !== n[e(195)] && (n.mouseOverTarget != null && n[e(195)][e(181)](o), a != null && a.pointerenterHandler(o)), n.mouseOverTarget = a, a != null)
      return void a[e(204)](o);
    let l = i.getCurrentLayer()._pickUp();
    l != null && (n.stage.setCursor(S.move), l[e(209)] && n.isConnectable(l) && n.connectBox[e(207)](l));
  }
  pointerenterHandler(t) {
    const e = E, n = this.editor;
    n.linkCtrlBox.pointerenterStageHandler(), n.nodeResizeBox[e(196)](), n.connectBox[e(196)]();
  }
  pointeroutHandler(t) {
    const e = E, n = this.editor;
    n.recordName != null && n.recordInterrupt(), n.linkCtrlBox.pointeroutStageHandler(), n.nodeResizeBox.pointeroutStageHandler(), n[e(189)].pointeroutStageHandler();
  }
  selectedGroupDragHandler(t, e) {
    const n = E, i = this.editor;
    if (i.stage[n(199)][n(197)] && i.record(n(202)), e[n(222)] == 1) {
      const o = e[0];
      i.stage[n(203)][n(194)](o._obb.aabb)[n(218)]();
    }
  }
  selectedGroupDragEndHandler(t, e) {
    const n = E, i = this.editor;
    i.stage[n(199)].isPointerOn ? (e.forEach((o) => {
      o[n(209)] && (o.x = Math.round(o.x), o.y = Math.round(o.y));
    }), i[n(220)]("对象拖拽")) : i[n(227)]();
  }
}
function ee() {
  const s = ["1075380CMKVAY", "39472VQsRTU", "map", "310rBjVXE", "_obb", "527pTjWHK", "filter", "3PGddgT", "getTopObjects", "下移一层", "aabb", "isNode", "width", "grid", "垂直中心对齐", "2746qyrXel", "428178GGUyPY", "translateWith", "length", "editor", "882RuEiFv", "4942026RMBMHY", "1604335BEOdxF", "begin", "raiseToTop", "顶部对齐", "getCenter", "761266hVnLAJ", "上移一层"];
  return (ee = function() {
    return s;
  })();
}
function K(s, t) {
  const e = ee();
  return (K = function(n, i) {
    return e[n -= 288];
  })(s, t);
}
(function() {
  const s = K, t = ee();
  for (; ; )
    try {
      if (parseInt(s(301)) / 1 * (parseInt(s(311)) / 2) + -parseInt(s(303)) / 3 * (-parseInt(s(296)) / 4) + parseInt(s(289)) / 5 + parseInt(s(312)) / 6 + -parseInt(s(316)) / 7 * (-parseInt(s(297)) / 8) + parseInt(s(288)) / 9 + -parseInt(s(299)) / 10 * (parseInt(s(294)) / 11) === 410058)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Ue {
  constructor(t) {
    this.editor = t;
  }
  changeLevel(t, e) {
    const n = K;
    e == n(295) ? R.raise(t) : e == n(305) ? R.lower(t) : e == "移至顶部" ? R[n(291)](t) : e == "移至底部" && R.lowerToBottom(t);
  }
  evenSpacing(t) {
    const e = K;
    let n = this.editor.stage.selectedGroup.getTopObjects();
    n = n[e(302)]((i) => i.isNode || i instanceof v && ge(i)), n.length;
  }
  align(t) {
    const e = K, n = this.editor;
    let i = n.stage.selectedGroup.getTopObjects();
    if (i = i.filter((a) => a[e(307)] || a instanceof v && ge(a)), i[e(314)] == 0)
      return;
    let o = i[e(298)]((a) => a._obb.aabb), r = ye.unionRects(o);
    for (let a = 0; a < i.length; a++) {
      let l = i[a], c = l[e(300)][e(306)];
      t == "左对齐" ? l[e(313)](r.x - c.x, 0) : t == "右对齐" ? l.translateWith(r.right - c.right, 0) : t == e(292) ? l.translateWith(0, r.y - c.y) : t == "底部对齐" ? l.translateWith(0, r.bottom - c.bottom) : t == "水平中心对齐" ? l.translateWith(0, r.middle - c.middle) : t == e(310) && l.translateWith(r.center - c.center, 0);
    }
    n.update();
  }
  doGridLayout() {
    const t = K;
    let e = this[t(315)].stage, n = e.selectedGroup[t(304)]().filter((c) => c instanceof w);
    if (n.length < 2)
      return;
    let i = Math.ceil(Math.sqrt(n[t(314)])), o = Ie.getUnionRect(n)[t(293)](), r = ke[t(309)](i, i), a = e.layoutSystem.pointsLayout(n, r), l = n[0][t(308)] * i;
    a.resize(l, l), a.translate(o.x, o.y), a.doLayout({ effect: "easeInQuart", duration: 300 });
  }
}
function ge(s) {
  return !s[K(290)].isDisplayObjectHost() && !s.end.isDisplayObjectHost();
}
function ne() {
  const s = ["1730790PpjJQM", "getLinkClassName", "width", "isLink", "stage", "4YxmAAZ", "652152snikDX", "getCurrentLayer", "editor", "2562849WPaZLv", "89443ODeZjU", "recordEnd", "setEnd", "133ePDjsZ", "49512ZbaYmK", "getObject", "removeFromParent", "ZIndex", "height", "unlinks", "includes", "479448TkkuBb", "setBegin", "4650770HjEpZS", "camera", "localView", "css"];
  return (ne = function() {
    return s;
  })();
}
function Y(s, t) {
  const e = ne();
  return (Y = function(n, i) {
    return e[n -= 258];
  })(s, t);
}
(function() {
  const s = Y, t = ne();
  for (; ; )
    try {
      if (parseInt(s(260)) / 1 + -parseInt(s(283)) / 2 + -parseInt(s(277)) / 3 + -parseInt(s(282)) / 4 * (-parseInt(s(273)) / 5) + parseInt(s(264)) / 6 * (parseInt(s(263)) / 7) + parseInt(s(271)) / 8 + parseInt(s(259)) / 9 === 618071)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Xe {
  constructor(t) {
    this[Y(258)] = t;
  }
  delete(t) {
    const e = Y;
    let n = this[e(258)];
    n.record("删除"), t.forEach(function(i) {
      const o = e;
      R[o(269)](i), i[o(266)]();
    });
    {
      let i = n.stage.camera[e(275)], o = i[e(265)]();
      o && !(o instanceof wt) && t[e(270)](o) && i.quit();
    }
    n.showOpTooltip("删除"), n[e(261)]("删除");
  }
  _addNewInstance(t) {
    const e = Y;
    this.editor.stage[e(274)][e(275)][e(265)]().addChild(t);
  }
  create(t) {
    const e = Y;
    let n = this[e(258)][e(281)].camera.localView.getMouseXY(), i = n.x, o = n.y, r = le.newInstance(t);
    if (r instanceof w)
      return r.x = i, r.y = o, r[e(279)] = 64, r[e(268)] = 64, this._addNewInstance(r), r;
    if (r instanceof v)
      return r[e(272)]({ x: i - 40, y: o }), r.setEnd({ x: i + 40, y: o + (t == "Link" ? 0 : 80) }), this._addNewInstance(r), r;
    throw new Error("unknow classname:" + t);
  }
  lineDrawn(t, e, n) {
    const i = Y;
    let o = this.editor, r = le.newInstance(o[i(278)]());
    r[i(272)](n), r[i(262)](e);
    const a = Object.assign({}, o.newLinkProperties);
    a.css && (r.setStyles(a[i(276)]), delete a[i(276)]), Object.keys(a).forEach((c) => {
      let h = a[c];
      r[c] = typeof h == "function" ? h() : h;
    });
    let l = t.isNode || t[i(280)] ? t.parent : o[i(284)]();
    return r.zIndex = ut[i(267)].EditorNewLink, l.addChild(r), o.dispatchEvent(new z("linkbegin", { target: r })), r;
  }
  lineDrawingFinished(t) {
    let e = new z("linkend", { target: t });
    this.editor.dispatchEvent(e);
  }
}
const X = it;
function se() {
  const s = ["aabb", "50460aRHHIJ", "getWorldTransform", "horizontalTarget", "camera", "1543124bFGbXz", "show", "dyLine", "hide", "right", "align", "getCurrentLayer", "filter", "12355BIJCvv", "editor", "sort", "setEnd", "minDistance", "bottom", "alignLineStyle", "3hAtDfR", "verticalType", "horizontalType", "_obb", "left", "887880ZXGtET", "vec", "enable", "dxLine", "parent", "pointerEnabled", "target", "abs", "alignInfo", "536NXsauy", "stage", "241346HcspQn", "_disabled", "visible", "init", "middle", "center", "pointermove", "scale", "1100795vLFCdL", "map", "addChild", "getAlignInfo", "707877gwmYFD", "handlerLayer", "selectedGroup"];
  return (se = function() {
    return s;
  })();
}
function it(s, t) {
  const e = se();
  return (it = function(n, i) {
    return e[n -= 329];
  })(s, t);
}
(function() {
  const s = it, t = se();
  for (; ; )
    try {
      if (-parseInt(s(363)) / 1 + -parseInt(s(347)) / 2 + parseInt(s(331)) / 3 * (parseInt(s(367)) / 4) + -parseInt(s(355)) / 5 + parseInt(s(336)) / 6 + -parseInt(s(375)) / 7 * (-parseInt(s(345)) / 8) + parseInt(s(359)) / 9 === 339377)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Ze {
  constructor(t) {
    const e = it;
    this._disabled = !1, this.visible = !1, this.editor = t, this[e(350)](t);
  }
  init(t) {
    const e = it;
    this.alignInfo = { horizontalType: null, verticalType: null, horizontalTarget: null, verticalTartet: null };
    let n = new v(null, { x: 0, y: 0 }, { x: 100, y: 100 });
    n.setStyles(I[e(372)].alignLineStyle), n.pointerEnabled = !1, this[e(339)] = n;
    let i = new v(null, { x: 0, y: 0 }, { x: 100, y: 100 });
    i.setStyles(I.align[e(330)]), i[e(341)] = !1, this.dyLine = i, n.hide(), i.hide(), t[e(360)][e(357)](n), t.handlerLayer[e(357)](i);
  }
  disable() {
    this._disabled = !0, this.dxLine.hide(), this.dyLine.hide();
  }
  [X(338)]() {
    this._disabled = !1;
  }
  [X(358)](t, e) {
    const n = X, i = this[n(376)].stage;
    let o = t.target;
    if (i[n(361)].objects.length > 1)
      return this.alignInfo.horizontalType = null, this[n(344)][n(332)] = null, this.alignInfo.horizontalTarget = null, this.alignInfo.verticalTartet = null, this.alignInfo;
    let r = U.aliagnAble(o, o);
    const a = i[n(373)]().displayList[n(374)](r);
    let l = this.editor[n(346)].camera[n(354)] * e;
    return this.findAlignRectInfo(o._obb.aabb, a, l);
  }
  pointerdownHandler(t) {
    this.dxLine.hide(), this.dyLine.hide();
  }
  pointerupHandler(t) {
    const e = X;
    if (this[e(348)])
      return;
    let n = t.previous, i = this.dxLine[e(349)] || this[e(369)].visible;
    if (n.type !== e(353) || i == 0)
      return;
    this.dxLine.hide(), this[e(369)].hide();
    let o = t.target;
    if (o == null || !U.isAlignable(this.editor))
      return;
    const r = Math.max(1, I[e(372)].gridSize);
    let a = o._obb.aabb, l = this.alignInfo;
    if (l.horizontalType != null) {
      let c = o[e(340)][e(364)]().invert(), h = l[e(365)]._obb.aabb[l[e(333)]] - a[l.horizontalType];
      if (h != 0) {
        let d = c[e(337)]([1, 1], [h, 1]);
        o.x += d[0];
      }
    } else
      o.x = Math.round(o.x / r) * r;
    if (l[e(332)] != null) {
      let c = o.parent[e(364)]().invert(), h = l.verticalTartet._obb[e(362)][l[e(332)]] - a[l.verticalType];
      if (h != 0) {
        let d = c[e(337)]([1, 1], [1, h]);
        o.y += d[1];
      }
    } else
      o.y = Math.round(o.y / r) * r;
  }
  _dragHandler(t) {
    const e = X;
    if (this[e(348)])
      return;
    let n = t[e(342)];
    if (n == null || !n.isNode || (this.dxLine[e(370)](), this[e(369)].hide(), !U.isAlignable(this[e(376)])))
      return;
    let i = this.dxLine, o = this.dyLine;
    const r = Math.max(0, I.align[e(379)]);
    r == 0 ? (this.alignInfo.horizontalType = null, this[e(344)].verticalType = null, this.alignInfo.horizontalTarget = null, this.alignInfo.verticalTartet = null) : this[e(344)] = this.getAlignInfo(t, r);
    const a = this.alignInfo, l = Math.max(1, I.align.gridSize);
    let c = n._obb.aabb, h = { x: Math.round(c.center / l) * l, y: Math.round(c[e(351)] / l) * l }, d = this.editor.stage[e(366)].toScreenXY(h.x, h.y);
    if (a[e(333)] != null) {
      let p = this[e(376)].stage.camera.toScreenRect(n._obb.aabb), u = this.editor[e(346)][e(366)].toScreenRect(a[e(365)]._obb[e(362)]), g = u[a.horizontalType], m = (p[e(351)] + u.middle) / 2, y = Math.abs(p[e(351)] - u[e(351)]);
      i.setBegin({ x: g, y: m - y / 2 }), i.setEnd({ x: g, y: m + y / 2 }), i[e(368)]();
    } else {
      let p = d.x, u = d.y, g = l;
      i.setBegin({ x: p, y: u - g / 2 }), i[e(378)]({ x: p, y: u + g / 2 }), i[e(368)]();
    }
    if (a.verticalType != null) {
      let p = this.editor[e(346)].camera.toScreenRect(n._obb.aabb), u = this.editor.stage.camera.toScreenRect(a.verticalTartet[e(334)].aabb), g = (p.center + u.center) / 2, m = u[a.verticalType], y = Math.abs(p.center - u[e(352)]);
      o.setBegin({ x: g - y / 2, y: m }), o.setEnd({ x: g + y / 2, y: m }), o.show();
    } else {
      let p = d.x, u = d.y, g = l;
      o.setBegin({ x: p - g / 2, y: u }), o.setEnd({ x: p + g / 2, y: u }), o.show();
    }
  }
  findAlignRectInfo(t, e, n) {
    const i = X;
    e[i(356)]((p) => p._obb[i(362)]);
    let o, r, a, l, c = Number.MAX_VALUE, h = Number.MAX_VALUE;
    e[i(377)]((p, u) => {
      const g = i;
      return Q.distance(t[g(352)], t.middle, u[g(334)].aabb.center, u._obb[g(362)].middle) - Q.distance(t.center, t.middle, p[g(334)].aabb.center, p._obb[g(362)][g(351)]);
    });
    let d = 0;
    for (let p = 0; p < e.length; p++) {
      let u = e[p], g = u._obb.aabb;
      g.isIntersectRect(t) || (d = Math.abs(t.top - g.top), d <= h && d <= n && (l = "top", r = u, h = d), d = Math.abs(t[i(329)] - g.bottom), d <= h && d <= n && (l = "bottom", r = u, h = d), d = Math.abs(t.middle - g[i(351)]), d <= h && d <= n && (l = i(351), r = u, h = d), d = Math.abs(t[i(335)] - g[i(335)]), d <= c && d < n && (a = "left", o = u, c = d), d = Math[i(343)](t[i(371)] - g[i(371)]), d <= c && d < n && (a = "right", o = u, c = d), d = Math.abs(t[i(352)] - g.center), d <= c && d < n && (a = "center", o = u, c = d));
    }
    return { horizontalType: a, verticalType: l, horizontalTarget: o, verticalTartet: r };
  }
}
const ct = rt;
function rt(s, t) {
  const e = ie();
  return (rt = function(n, i) {
    return e[n -= 342];
  })(s, t);
}
(function() {
  const s = rt, t = ie();
  for (; ; )
    try {
      if (-parseInt(s(358)) / 1 + parseInt(s(350)) / 2 * (parseInt(s(342)) / 3) + parseInt(s(343)) / 4 + parseInt(s(362)) / 5 * (-parseInt(s(356)) / 6) + parseInt(s(346)) / 7 * (parseInt(s(351)) / 8) + parseInt(s(347)) / 9 + -parseInt(s(344)) / 10 * (parseInt(s(348)) / 11) === 679938)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class Je {
  constructor(t) {
    this[rt(355)] = !0, this.editor = t;
  }
  init() {
    const t = rt, e = this[t(360)].handlerLayer, n = new v();
    n.name = "guidLineW", n[t(363)] = !1, n.setStyles(I.crossGuildLine[t(364)]), n[t(359)](), this[t(345)] = n, e.addChild(this.guildlineH);
    const i = new v();
    i[t(352)] = t(353), i[t(363)] = !1, i[t(354)](I.crossGuildLine[t(366)]), i.hide(), this.guildlineV = i, e[t(365)](this.guildlineV);
  }
  disable() {
    this._disabled = !0, this.hideGuidLine();
  }
  [ct(361)]() {
    this[ct(355)] = !1, this.guildlineH == null && this.init();
  }
  updateGuildLine() {
    const t = ct;
    if (this._disabled)
      return;
    const e = this.editor.stage, n = this[t(345)], i = this.guildlineV, o = e[t(357)], r = o.x, a = o.y;
    n[t(367)]({ x: 0, y: a }), n.setEnd({ x: e.width, y: a }), n[t(349)](), i.setBegin({ x: r, y: 0 }), i.setEnd({ x: r, y: e.height }), i.show();
  }
  hideGuidLine() {
    const t = ct;
    this.guildlineH[t(359)](), this.guildlineV.hide();
  }
}
function ie() {
  const s = ["_disabled", "19884cfQhqR", "inputSystem", "203207gGvPif", "hide", "editor", "enable", "1915gpRZTx", "pointerEnabled", "styleH", "addChild", "styleV", "setBegin", "1318263vfIPGM", "5046228CfHbnc", "10sfMWIS", "guildlineH", "87647eveIUt", "5304285nmPboa", "14050817iRastj", "show", "2LcIQvT", "728oqZkLy", "name", "guidLineS", "setStyles"];
  return (ie = function() {
    return s;
  })();
}
const f = J;
function re() {
  const s = ["data", "redoUndoSys", "imageToBase64", "1659187zmYXSH", "disableConnect", "reset", "open", "10828056loiOjz", "selectedGroupDragHandler", "lastLayerState", "pointermoveHandler", "disableEdit", "stage", "linkCtrlBox", "31074453EELUCV", "quit", "9704316pDaNFG", "dispatchEvent", "sendKey", "clientX", "pointeroutHandler", "inputSystem", "recordName", "keyboard", "LinkClassName", "wheelHandler", "setItem", "toJSON", "serializerSystem", "event", "_clearTarget", "keyConfig", "setConnectable", "defaultPrevented", "getEditInfo", "isUpdateMatrixed", "controlTarget", "dblclickHandler", "popupMenu", "isDraging", "style", "beginArrow", "1702335TOOkLC", "5704090LFjTkj", "_dragHandler", "3279236xwxkxL", "2ijwRRt", "hide", "getBoundingClientRect", "inputTextfield", "3eCSrJl", "set", "handlerLayer", "pointupHandler", "setEditable", "keyManager", "addEventListener", "get", "enter", "connectBox", "getCurrentLayer", "push", "_disableEditMap", "assign", "localLastDocName", "update", "clear", "nodeResizeBox", "editorEventManager", "打开json", "length", "clipboardManager", "parse", "_getState", "pointerEnabled", "stringify", "existObjectMap"];
  return (re = function() {
    return s;
  })();
}
function J(s, t) {
  const e = re();
  return (J = function(n, i) {
    return e[n -= 396];
  })(s, t);
}
(function() {
  const s = J, t = re();
  for (; ; )
    try {
      if (parseInt(s(422)) / 1 * (parseInt(s(465)) / 2) + -parseInt(s(469)) / 3 * (parseInt(s(464)) / 4) + parseInt(s(461)) / 5 + -parseInt(s(435)) / 6 + -parseInt(s(462)) / 7 + -parseInt(s(426)) / 8 + parseInt(s(433)) / 9 === 846799)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
})();
class qe extends fe {
  constructor(t) {
    const e = J;
    super(), this.existObjectMap = /* @__PURE__ */ new WeakMap(), this[e(450)] = dt, this.config = I, this[e(443)] = "AutoFoldLink", this.newLinkProperties = {}, this.DataCenter = We, this[e(421)] = !1, this._disableEditMap = /* @__PURE__ */ new Map(), this._disableConnectMap = /* @__PURE__ */ new Map(), this.stage = t, t.editor = this, this[e(471)] = t.handlerLayer, this.keyboard = t[e(442)], this[e(413)] = new Ge(this), this.instanceManager = new Xe(this), this.editorEventManager = new Ke(this), this[e(397)] = new Re(this), this.nodeResizeBox = new He(this), this.linkCtrlBox = new Be(this), this.connectBox = new Ne(this), this.dropToBox = new Fe(this), this[e(457)] = function(n) {
      const i = Xt, o = n[i(141)];
      let r = new Te(o, `
<div class="header">编辑</div>
<a>剪切</a>
<a>复制</a>
<a>粘贴</a>
<a>删除</a> 
<hr></hr>
<div class="header">前后</div>
<a>上移一层</a>
<a>下移一层</a>
<a>移至顶部</a>
<a>移至底部</a>
<div class="header">对齐</div>
<a>左对齐</a>
<a>右对齐</a>
<a>顶部对齐</a>
<a>底部对齐</a>
<a>水平中心对齐</a>
<a>垂直中心对齐</a>
`);
      return r[i(145)]("select", function(a) {
        const l = i, c = a.item;
        let h = o.inputSystem.target;
        c == "剪切" ? n[l(152)].cutHandler() : c == "复制" ? n.clipboardManager.copyHandler() : c == "粘贴" ? n.clipboardManager.pasteHandler() : c == "删除" && n[l(139)].deleteHandler(), h != null && (c == "上移一层" ? n.layoutManager[l(143)](h, c) : c == l(142) || c == "移至顶部" ? n[l(149)][l(143)](h, c) : c == l(136) ? n[l(149)].changeLevel(h, c) : c == l(133) ? n.layoutManager.align("左对齐") : c == "右对齐" ? n[l(149)].align("右对齐") : c == l(137) ? n.layoutManager[l(155)](l(137)) : c == "底部对齐" ? n.layoutManager.align("底部对齐") : c == "水平中心对齐" ? n[l(149)][l(155)]("水平中心对齐") : c == "垂直中心对齐" ? n.layoutManager[l(155)]("垂直中心对齐") : c == "左右等距" ? n.layoutManager[l(146)]("左右等距") : c == "上下等距" && n.layoutManager.evenSpacing("上下等距"), n.update());
      }), r;
    }(this), this[e(431)][e(440)][e(449)](), this.controlTarget = null, this.mouseOverTarget = null, this[e(468)] = new Le(t), this[e(420)] = new De(this), this.layoutManager = new Ue(this), this.alignManager = new Ze(this), this.opTooltip = new Ee(t), Object[e(405)](this.opTooltip.domElement[e(459)], { paddingLeft: "20px", paddingRight: "20px", color: "black" }), this.pointerCrossLineManager = new Je(this);
  }
  setLinkClassName(t) {
    this.LinkClassName = t;
  }
  getLinkClassName() {
    return this[J(443)];
  }
  [f(402)]() {
    return this[f(431)].getCurrentLayer();
  }
  defineKeys(t) {
    Object.assign(this.keyConfig, t);
  }
  showOpTooltip(t) {
    const e = f;
    I.operationTip.enable && (this.opTooltip.setHtml(t), this.opTooltip.showAt(0.5 * this[e(431)].width, 0.5 * this[e(431)].height), this.opTooltip.fadeOut());
  }
  saveHandler(t, e = !1) {
    const n = f;
    let i = this;
    if (e == 1)
      return void this.stage.toJSONWithBase64().then((a) => {
        const l = J;
        let c = JSON.stringify(a);
        this.DataCenter.setItem(I[l(419)][l(406)], c), i.dispatchEvent(new z("save", { details: { imageToBase64: e, json: c } }));
      });
    let o = this[n(431)][n(446)](), r = JSON[n(417)](o);
    this.DataCenter[n(445)](I.data.localLastDocName, r), i.dispatchEvent(new z("save", { details: { imageToBase64: e, json: r } }));
  }
  openLasted() {
    const t = f;
    let e = this.DataCenter.getItem(I.data.localLastDocName);
    if (e != null) {
      let n = JSON[t(414)](e);
      console.log(t(411), n), this.stage.fromJSON(n);
    }
    return null;
  }
  addEventListener(t, e) {
    return super[f(398)](t, e);
  }
  removeEventListener(t, e) {
    return super.removeEventListener(t, e);
  }
  hasListener(t) {
    return super.hasListener(t);
  }
  _checkState() {
    const t = f;
    let e = this[t(431)].getCurrentLayer();
    return !(e == null || !e[t(416)]) || (this._hideAllAttaches(), !1);
  }
  [f(456)](t) {
    const e = f;
    this[e(410)].dblclickHandler(t), this[e(407)]();
  }
  [f(444)](t) {
    this[f(410)].mousewheelHandler(t), this.update();
  }
  pointerdownHandler(t) {
    const e = f;
    this._checkState() && (this[e(410)].pointerdownHandler(t), this.update(), this[e(431)].inputSystem[e(448)][e(452)] || this.popupMenu.hide());
  }
  pointerupHandler(t) {
    const e = f;
    if (!this._checkState())
      return;
    this.editorEventManager[e(472)](t), this.update();
    let n = this[e(431)].inputSystem;
    n.button == 2 ? !n.isDragEnd && this.popupMenu.showAt(n.x, n.y) : this.popupMenu[e(466)]();
  }
  _dragHandler(t) {
    this[f(410)]._dragHandler(t), this.update(), this.pointerCrossLineManager.updateGuildLine();
  }
  pointermoveHandler(t) {
    const e = f;
    if (this._checkState())
      return this.stage.inputSystem[e(458)] ? this[e(463)](t) : (this.editorEventManager[e(429)](t), this[e(455)] && this.stage.handlerLayer.update(), void this.pointerCrossLineManager.updateGuildLine());
  }
  pointerenterHandler(t) {
    this.editorEventManager.pointerenterHandler(t), this.update();
  }
  pointeroutHandler(t) {
    const e = f;
    this.editorEventManager[e(439)](t), this.update();
  }
  dropHandler(t) {
    this[f(431)].inputSystem.event.defaultPrevented || this.dispatchEvent(t);
  }
  dragoverHandler(t) {
    t.preventDefault(), this.dispatchEvent(t);
  }
  selectedGroupDragHandler(t, e) {
    const n = f;
    this.editorEventManager[n(427)](t, e);
  }
  selectedGroupDragEndHandler(t, e) {
    this.editorEventManager.selectedGroupDragEndHandler(t, e);
  }
  recordInterrupt() {
    this.recordName != null && this.recordEnd(this.recordName), this.recordName = null, this.lastLayerState = null;
  }
  record(t) {
    const e = f;
    let n = this[e(402)]();
    if (n == null)
      return;
    let i = n.stage[e(447)];
    this.recordName, this[e(441)] = t, this[e(428)] = i[e(415)](n, this[e(418)]);
  }
  recordEnd(t) {
    const e = f;
    this.recordName, this[e(441)] = null;
    const n = this.existObjectMap;
    let i = this.getCurrentLayer();
    if (i == null)
      return;
    let o = i[e(431)].serializerSystem, r = this.lastLayerState, a = o._getState(i, n);
    this[e(420)][e(403)](t, function() {
      o._restoreFromState(a, n);
    }, function() {
      o._restoreFromState(r, n);
    });
  }
  update() {
    const t = f;
    this.dropToBox.update(), this.nodeResizeBox[t(407)](), this[t(432)].update(), this[t(401)][t(407)]();
  }
  _hideAllAttaches() {
    const t = f;
    this.dropToBox.hide(), this[t(409)][t(466)](), this.linkCtrlBox.hide(), this.connectBox[t(466)](), this.nodeResizeBox.clearTarget(), this.linkCtrlBox.clearTarget(), this.connectBox.clearTarget();
  }
  openJson(t) {
    const e = f;
    return this[e(431)].fromJSON(t).then(() => {
      const n = e;
      this[n(436)](new z(n(425), { details: { json: t } }));
    });
  }
  showTip(t, e = "") {
    const n = f;
    let i = new Event("log");
    i.msg = t + e, this[n(436)](i);
  }
  create(t) {
    return this.instanceManager.create(t);
  }
  mockDrop(t) {
    const e = f, n = t.changedTouches[0], i = this.stage[e(471)].render.canvas[e(467)](), o = n[e(438)] - i.left, r = n.clientY - i.top;
    this.stage.inputSystem.x = o, this.stage.inputSystem.y = r, this[e(436)](new PointerEvent("drop"));
  }
  clearCtrlBoxs() {
    this[f(401)].clearTarget(), this.nodeResizeBox.clearTarget(), this.linkCtrlBox.clearTarget();
  }
  toogleLocalView() {
    const t = f;
    let e = this.stage[t(440)].target;
    e === this.stage.camera.localView.object ? this.stage.camera.localView[t(434)]() : this.stage.camera.localView[t(400)](e);
  }
  [f(437)](t, e) {
    const n = f;
    this.keyboard[n(437)](t, e);
  }
  onEsc() {
    this[f(401)].cancel();
  }
  [f(396)](t, e) {
    e ? this[f(404)].delete(t) : this._disableEditMap.set(t, !0);
  }
  [f(451)](t, e) {
    const n = f;
    e ? this._disableConnectMap.delete(t) : this._disableConnectMap[n(470)](t, !0);
  }
  isEditable(t) {
    const e = f;
    return t != null && this._disableEditMap.get(t) == null && !!U[e(454)](t) && (!(t.parent instanceof v) || t !== t.parent.label && t !== t.parent.beginArrow && t !== t.parent.endArrow);
  }
  isConnectable(t) {
    const e = f;
    if (t == null || !t.visible || !t.pointerEnabled)
      return !1;
    let n = t.parent;
    return (!(n instanceof v) || t !== n.label && n[e(460)] !== t && n.endArrow !== t) && this._disableConnectMap[e(399)](t) == null;
  }
  [f(453)](t, e) {
    const n = f;
    let i = { disableEdit: [], disableConnect: [] };
    for (let o = 0; o < t[n(412)]; o++) {
      let r = t[o], a = e[n(399)](r);
      !this.isEditable(r) && a != null && i.disableEdit.push(a), !this.isConnectable(r) && a != null && i.disableConnect.push(a);
    }
    return i[n(430)].length == 0 && delete i.disableEdit, i.disableConnect[n(412)] == 0 && delete i[n(423)], i.disableEdit || i[n(423)] ? i : null;
  }
  fromEditInfo(t, e) {
    if (t.disableEdit != null)
      for (let n = 0; n < t.disableEdit.length; n++) {
        let i = e[t.disableEdit[n]];
        this.setEditable(i, !1);
      }
    if (t.disableConnect != null)
      for (let n = 0; n < t.disableConnect.length; n++) {
        let i = e[t.disableConnect[n]];
        this.setConnectable(i, !1);
      }
  }
  reset() {
    const t = f;
    this._hideAllAttaches(), this[t(420)][t(408)](), this.clipboardManager[t(424)](), this.pickedObject = null, this.mouseOverTarget = null, this[t(455)] = null, this.inputTextfield.hide();
  }
}
function oe() {
  var s = ["225jvDSrG", "16CdQfQy", "38114FRPoqG", "2646964FrQare", "4222410dwLToG", "2694648WXyRcp", "15570Hakyae", "3ApwREU", "735231xcaDkN", "16JUsMyA", "1133130sJOnMy"];
  return (oe = function() {
    return s;
  })();
}
function xe(s, t) {
  var e = oe();
  return (xe = function(n, i) {
    return e[n -= 500];
  })(s, t);
}
qe.KeysConfig = dt, function() {
  for (var s = xe, t = oe(); ; )
    try {
      if (-parseInt(s(508)) / 1 * (-parseInt(s(507)) / 2) + -parseInt(s(502)) / 3 * (parseInt(s(509)) / 4) + parseInt(s(505)) / 5 + parseInt(s(510)) / 6 + -parseInt(s(503)) / 7 * (-parseInt(s(504)) / 8) + parseInt(s(506)) / 9 * (parseInt(s(501)) / 10) + -parseInt(s(500)) / 11 === 577555)
        break;
      t.push(t.shift());
    } catch {
      t.push(t.shift());
    }
}();
export {
  qe as Editor,
  tn as IconsPanel,
  en as PropertiesPanel
};
